1 color.module | _color_unpack($hex, $normalize = FALSE) |
Converts a hex color into an RGB triplet.
File
- core/
modules/ color/ color.module, line 877 - Allows users to change the color scheme of themes.
Code
function _color_unpack($hex, $normalize = FALSE) {
$hex = substr($hex, 1);
if (strlen($hex) == 3) {
$hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2];
}
$c = hexdec($hex);
for ($i = 16; $i >= 0; $i -= 8) {
$out[] = (($c >> $i) & 0xFF) / ($normalize ? 255 : 1);
}
return $out;
}