diff options
-rw-r--r-- | scss/extension/compass/gradients.py | 11 | ||||
-rw-r--r-- | scss/tests/files/compass/current-color.css | 3 | ||||
-rw-r--r-- | scss/tests/files/compass/current-color.scss | 4 |
3 files changed, 15 insertions, 3 deletions
diff --git a/scss/extension/compass/gradients.py b/scss/extension/compass/gradients.py index dbcaea8..031fba2 100644 --- a/scss/extension/compass/gradients.py +++ b/scss/extension/compass/gradients.py @@ -19,6 +19,11 @@ log = logging.getLogger(__name__) ns = CompassExtension.namespace +def _is_color(value): + # currentColor is not a Sass color value, but /is/ a CSS color value + return isinstance(value, Color) or value == String('currentColor') + + def __color_stops(percentages, *args): if len(args) == 1: if isinstance(args[0], (list, tuple, List)): @@ -42,7 +47,7 @@ def __color_stops(percentages, *args): prev_color = False for c in args: for c in List.from_maybe(c): - if isinstance(c, Color): + if _is_color(c): if prev_color: stops.append(None) colors.append(c) @@ -169,7 +174,7 @@ def _get_gradient_position_and_angle(args): ret = None skip = False for a in arg: - if isinstance(a, Color): + if _is_color(a): skip = True break elif isinstance(a, Number): @@ -205,7 +210,7 @@ def _get_gradient_color_stops(args): color_stops = [] for arg in args: for a in List.from_maybe(arg): - if isinstance(a, Color): + if _is_color(a): color_stops.append(arg) break return color_stops or None diff --git a/scss/tests/files/compass/current-color.css b/scss/tests/files/compass/current-color.css new file mode 100644 index 0000000..302ddc9 --- /dev/null +++ b/scss/tests/files/compass/current-color.css @@ -0,0 +1,3 @@ +p { + background-image: linear-gradient(to top, transparent, currentColor); +} diff --git a/scss/tests/files/compass/current-color.scss b/scss/tests/files/compass/current-color.scss new file mode 100644 index 0000000..9922299 --- /dev/null +++ b/scss/tests/files/compass/current-color.scss @@ -0,0 +1,4 @@ +p { + // currentColor is not actually a SCSS color value, but should be left alone + background-image: linear-gradient(to top, transparent, currentColor); +} |