// Color Functions // -------------------------------------------------- @function inverse($color-value) { $lightness: lightness($color-value); $red: red($color-value); $green: green($color-value); @if ($lightness > 65 or $green > 220 or ($red > 240 and $green > 180)) { @return black; } @return white; } @function color-shade($color-value, $amount:8%) { $lightness: lightness($color-value); $shade: white; @if ($lightness > 50) { $shade: black; } @return mix($shade, $color-value, $amount); } @function color($color-name) { @return map-get($colors, $color-name); } @function auxiliary-colors() { // get a map of all the colors, except "primary" @return map-remove($colors, primary); } // String Replace Function // -------------------------------------------------- @function str-replace($string, $search, $replace: '') { $index: str-index($string, $search); @if $index { @return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace); } @return $string; } // URL Encode Function // -------------------------------------------------- @function url-encode($val) { @return str-replace($val, ' ', '%20'); }