Same name and namespace in other branches
- 7.x-1.x color_field.module \color_field_hex2rgb() 1 comment
- 8.x-1.x color_field.module \color_field_hex2rgb() 1 comment
Helper: Convert HEX6 to RGB.
Parameters
string $hex: The colors specified as an hexadecimal format (a hex triplet) (134E1A).
Return value
string $rgba The colors specified as an RGB triplet.
File
-
./
color_field.module, line 117
Code
function color_field_hex2rgb($hex = FALSE) {
$r = hexdec(substr($hex, 0, 2));
$g = hexdec(substr($hex, 2, 2));
$b = hexdec(substr($hex, -2));
return compact('r', 'g', 'b');
}