summaryrefslogtreecommitdiff
path: root/scss/extension/compass/gradients.py
diff options
context:
space:
mode:
authorEevee (Lexy Munroe) <eevee.git@veekun.com>2016-06-08 17:29:40 -0700
committerEevee (Lexy Munroe) <eevee.git@veekun.com>2016-06-08 17:29:40 -0700
commit1f3a76655de764cd66f0ddb42b3d99e6020c1dca (patch)
tree918c6d5a72f615537cd42760a019af599fb41452 /scss/extension/compass/gradients.py
parent3edf81a3ebfbc913c1dceeba7add454e7ce6c1c9 (diff)
downloadpyscss-1f3a76655de764cd66f0ddb42b3d99e6020c1dca.tar.gz
Compass should treat currentColor as a color. Fixes #354
Diffstat (limited to 'scss/extension/compass/gradients.py')
-rw-r--r--scss/extension/compass/gradients.py11
1 files changed, 8 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