function color_field_hex2rgb in Color Field 7.2
Same name and namespace in other branches
- 8 color_field.module \color_field_hex2rgb()
- 7 color_field.module \color_field_hex2rgb()
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 113
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');
}