summaryrefslogtreecommitdiff
path: root/scss/extension/core.py
diff options
context:
space:
mode:
Diffstat (limited to 'scss/extension/core.py')
-rw-r--r--scss/extension/core.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/scss/extension/core.py b/scss/extension/core.py
index 7b69315..966a830 100644
--- a/scss/extension/core.py
+++ b/scss/extension/core.py
@@ -378,6 +378,12 @@ def invert(color):
"""Returns the inverse (negative) of a color. The red, green, and blue
values are inverted, while the opacity is left alone.
"""
+ if isinstance(color, Number):
+ # invert(n) and invert(n%) are CSS3 filters and should be left
+ # intact
+ return String.unquoted("invert(%s)" % (color.render(),))
+
+ expect_type(color, Color)
r, g, b, a = color.rgba
return Color.from_rgb(1 - r, 1 - g, 1 - b, alpha=a)