diff options
author | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2013-08-19 17:58:26 -0700 |
---|---|---|
committer | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2013-08-19 17:58:26 -0700 |
commit | 84aef8d2468cf1a4e9deef561bf018835bc79d90 (patch) | |
tree | d3347a3de5638d6568b75212b452b33fce3bbb7d | |
parent | 20118267cc0753baa6e31a3873f2aa1383db2f95 (diff) | |
download | pyscss-84aef8d2468cf1a4e9deef561bf018835bc79d90.tar.gz |
Make the CSS3 filter grayscale(n) work.
-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) |