From 84aef8d2468cf1a4e9deef561bf018835bc79d90 Mon Sep 17 00:00:00 2001 From: "Eevee (Alex Munroe)" Date: Mon, 19 Aug 2013 17:58:26 -0700 Subject: Make the CSS3 filter grayscale(n) work. --- scss/functions/core.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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) -- cgit v1.2.1