diff --git a/sass/chroma/_functions.scss b/sass/chroma/_functions.scss index d2698b6..68da83c 100644 --- a/sass/chroma/_functions.scss +++ b/sass/chroma/_functions.scss @@ -202,7 +202,7 @@ $chroma: _chroma-init(); $function: map-get(nth($chain, $i), 'function'); $parameters: map-get(nth($chain, $i), 'parameters'); $parameters: set-nth($parameters, 1, $value); - $value: call($function, $parameters...); + $value: _safe-call($function, $parameters...); } } @return $value; @@ -382,7 +382,7 @@ $chroma: _chroma-init(); // If the value given is a color, just add it. @if type-of($color-value) == 'color' and not (_is-old-libsass() and _is-keyword-string($color-value)) { @if $color-function { - $color-value: call($color-function, $color-parameters...); + $color-value: _safe-call($color-function, $color-parameters...); } $chroma: _chroma-add-name($scheme, $color-name, $value : $color-value, @@ -405,7 +405,7 @@ $chroma: _chroma-init(); $new-value: map-get($referenced-color, 'value'); @if $color-function { $color-parameters: set-nth($color-parameters, 1, $new-value); - $new-value: call($color-function, $color-parameters...); + $new-value: _safe-call($color-function, $color-parameters...); } $chroma: _chroma-add-name($scheme, $color-name, $value : $new-value, diff --git a/sass/chroma/_internals.scss b/sass/chroma/_internals.scss index 815b7e1..55ecf58 100644 --- a/sass/chroma/_internals.scss +++ b/sass/chroma/_internals.scss @@ -129,3 +129,19 @@ @function _is-keyword-string($name) { @return if(map-has-key($_chroma-css4-color-keywords-in-strings, $name), true, false); } + +// _safe-call() +// +// LibSass incorrectly throws an error when using call() with an overloaded +// function; e.g. rgba(). To work-around this bug, we call rgba() directly +// instead of with call(). +// +// @TODO: Remove when the fix for https://github.com/sass/libsass/issues/2205 is released. +// +// Style guide: internals._safe-call +@function _safe-call($function, $parameters...) { + @if $function == rgba { + @return rgba($parameters...); + } + @return call($function, $parameters...); +}