-
-
Save englishextra/3af2d4d1c5b0d89f4b88324d593b3cde to your computer and use it in GitHub Desktop.
URL-encode color SASS function / convert color to hex SASS function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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