_color_pack($rgb, $normalize = FALSE)
Converts an RGB triplet to a hex color.
File
- core/modules/color/color.module, line 768
- Allows users to change the color scheme of themes.
Code
1 2 3 4 5 6 7 8 | function _color_pack( $rgb , $normalize = FALSE) { $out = 0; foreach ( $rgb as $k => $v ) { $out |= (( $v * ( $normalize ? 255 : 1)) << (16 - $k * 8)); } return '#' . str_pad ( dechex ( $out ), 6, 0, STR_PAD_LEFT); } |
Please login to continue.