summaryrefslogtreecommitdiff
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
parent3edf81a3ebfbc913c1dceeba7add454e7ce6c1c9 (diff)
downloadpyscss-1f3a76655de764cd66f0ddb42b3d99e6020c1dca.tar.gz
Compass should treat currentColor as a color. Fixes #354
-rw-r--r--scss/extension/compass/gradients.py11
-rw-r--r--scss/tests/files/compass/current-color.css3
-rw-r--r--scss/tests/files/compass/current-color.scss4
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);
+}