Same name and namespace in other branches
- 7.x-1.x color_field.module \color_field_rgb2hex() 1 comment
- 7.x-2.x color_field.module \color_field_rgb2hex() 1 comment
Helper: Convert RGB to HEX6
Parameters
$rgb Must be an array indexed on r, g and b.:
File
-
./
color_field.module, line 40
Code
function color_field_rgb2hex($rgb = FALSE) {
$hex = '';
$hex .= str_pad(dechex($rgb[0]), 2, "0", STR_PAD_LEFT);
$hex .= str_pad(dechex($rgb[1]), 2, "0", STR_PAD_LEFT);
$hex .= str_pad(dechex($rgb[2]), 2, "0", STR_PAD_LEFT);
return $hex;
// returns the hex value including the number sign (#)
}