function _color_pack
_color_pack($rgb, $normalize = FALSE)
Converts an RGB triplet to a hex color.
File
- modules/color/color.module, line 751
- Allows users to change the color scheme of themes.
Code
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); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!color!color.module/function/_color_pack/7.x