Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
URL-encode color SASS function / convert color to hex SASS function
//does not work with colors containing alpha
@function encodecolor($string) {
@if type-of($string) == 'color' {
$hex: str-slice(ie-hex-str($string), 4);
$string:unquote("#{$hex}");
}
$string: '%23' + $string;
@return $string;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment