function _color_unpack
7.x color.module | _color_unpack($hex, $normalize = FALSE) |
6.x color.module | _color_unpack($hex, $normalize = false) |
Converts a hex color into an RGB triplet.
3 calls to _color_unpack()
- _color_blend in drupal-7.x/
modules/ color/ color.module - Blends two hex colors and returns the GD color.
- _color_gd in drupal-7.x/
modules/ color/ color.module - Converts a hex triplet into a GD color.
- _color_shift in drupal-7.x/
modules/ color/ color.module - Shifts a given color, using a reference pair and a target blend color.
File
- drupal-7.x/
modules/ color/ color.module, line 736 - Allows users to change the color scheme of themes.
Code
function _color_unpack($hex, $normalize = FALSE) {
if (strlen($hex) == 4) {
$hex = $hex[1] . $hex[1] . $hex[2] . $hex[2] . $hex[3] . $hex[3];
}
$c = hexdec($hex);
for ($i = 16; $i >= 0; $i -= 8) {
$out[] = (($c >> $i) & 0xFF) / ($normalize ? 255 : 1);
}
return $out;
}