diff options
Diffstat (limited to 'scss/functions/core.py')
-rw-r--r-- | scss/functions/core.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/scss/functions/core.py b/scss/functions/core.py index e8ce9e7..402e581 100644 --- a/scss/functions/core.py +++ b/scss/functions/core.py @@ -320,9 +320,18 @@ def desaturate(color, amount): @register('greyscale', 1) +def greyscale(color): + return __hsl_op(operator.__sub__, color, 0, 100.0, 0) + + @register('grayscale', 1) def grayscale(color): - return __hsl_op(operator.__sub__, color, 0, 100.0, 0) + if isinstance(color, Number) and color.is_unitless: + # grayscale(n) is a CSS3 filter and should be left intact, but only + # when using the "a" spelling + return String.unquoted("grayscale(%d)" % (color.value,)) + else: + return greyscale(color) @register('spin', 2) |