function _fivestar_color_pack in Fivestar 6
Same name and namespace in other branches
- 5 fivestar_color.inc \_fivestar_color_pack()
- 6.2 includes/fivestar.color.inc \_fivestar_color_pack()
Convert an RGB triplet to a hex color.
1 call to _fivestar_color_pack()
- _fivestar_color_blend in ./
fivestar_color.inc - Blend two hex colors and return the resulting hex color.
File
- ./
fivestar_color.inc, line 379 - File containing functions relating to the color widget.
Code
function _fivestar_color_pack($rgb, $normalize = FALSE) {
foreach ($rgb as $k => $v) {
$out |= $v * ($normalize ? 255 : 1) << 16 - $k * 8;
}
return '#' . str_pad(dechex($out), 6, 0, STR_PAD_LEFT);
}