_color_unpack

_color_unpack($hex, $normalize = FALSE) Converts a hex color into an RGB triplet. File core/modules/color/color.module, line 753 Allows users to change the color scheme of themes. Code function _color_unpack($hex, $normalize = FALSE) { if (strlen($hex) == 4) { $hex = $hex[1] . $hex[1] . $hex[2] . $hex[2] . $hex[3] . $hex[3]; } $c = hexdec($hex); for ($i = 16; $i >= 0; $i -= 8) { $out[] = (($c >> $i) & 0xFF) / ($normalize ? 255 : 1); } return $out; }

_color_shift

_color_shift($given, $ref1, $ref2, $target) Shifts a given color, using a reference pair and a target blend color. Note: this function is significantly different from the JS version, as it is written to match the blended images perfectly. Constraint: if (ref2 == target + (ref1 - target) * delta) for some fraction delta then (return == target + (given - target) * delta). Loose constraint: Preserve relative positions in saturation and luminance space. File core/modules/color/color.module, line 68

_color_save_stylesheet

_color_save_stylesheet($file, $style, &$paths) Saves the rewritten stylesheet to disk. File core/modules/color/color.module, line 582 Allows users to change the color scheme of themes. Code function _color_save_stylesheet($file, $style, &$paths) { $filepath = file_unmanaged_save_data($style, $file, FILE_EXISTS_REPLACE); $paths['files'][] = $filepath; // Set standard file permissions for webserver-generated files. drupal_chmod($file); }

_color_rgb2hsl

_color_rgb2hsl($rgb) Converts an RGB triplet to HSL. File core/modules/color/color.module, line 809 Allows users to change the color scheme of themes. Code function _color_rgb2hsl($rgb) { $r = $rgb[0]; $g = $rgb[1]; $b = $rgb[2]; $min = min($r, min($g, $b)); $max = max($r, max($g, $b)); $delta = $max - $min; $l = ($min + $max) / 2; $s = 0; if ($l > 0 && $l < 1) { $s = $delta / ($l < 0.5 ? (2 * $l) : (2 - 2 * $l)); } $h = 0; if ($delta > 0) {

_color_rewrite_stylesheet

_color_rewrite_stylesheet($theme, &$info, &$paths, $palette, $style) Rewrites the stylesheet to match the colors in the palette. File core/modules/color/color.module, line 512 Allows users to change the color scheme of themes. Code function _color_rewrite_stylesheet($theme, &$info, &$paths, $palette, $style) { // Prepare color conversion table. $conversion = $palette; foreach ($conversion as $k => $v) { $conversion[$k] = Unicode::strtolower($v); } $default = c

_color_render_images

_color_render_images($theme, &$info, &$paths, $palette) Renders images that match a given palette. File core/modules/color/color.module, line 593 Allows users to change the color scheme of themes. Code function _color_render_images($theme, &$info, &$paths, $palette) { // Prepare template image. $source = $paths['source'] . '/' . $info['base_image']; $source = imagecreatefrompng($source); $width = imagesx($source); $height = imagesy($source); // Prepare target buff

_color_pack

_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 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); }

_color_hue2rgb

_color_hue2rgb($m1, $m2, $h) Helper function for _color_hsl2rgb(). File core/modules/color/color.module, line 797 Allows users to change the color scheme of themes. Code function _color_hue2rgb($m1, $m2, $h) { $h = ($h < 0) ? $h + 1 : (($h > 1) ? $h - 1 : $h); if ($h * 6 < 1) { return $m1 + ($m2 - $m1) * $h * 6; } if ($h * 2 < 1) { return $m2; } if ($h * 3 < 2) { return $m1 + ($m2 - $m1) * (0.66666 - $h) * 6; } return $m1; }

_color_hsl2rgb

_color_hsl2rgb($hsl) Converts an HSL triplet into RGB. File core/modules/color/color.module, line 780 Allows users to change the color scheme of themes. Code function _color_hsl2rgb($hsl) { $h = $hsl[0]; $s = $hsl[1]; $l = $hsl[2]; $m2 = ($l <= 0.5) ? $l * ($s + 1) : $l + $s - $l * $s; $m1 = $l * 2 - $m2; return array( _color_hue2rgb($m1, $m2, $h + 0.33333), _color_hue2rgb($m1, $m2, $h), _color_hue2rgb($m1, $m2, $h - 0.33333), ); }

_color_gd

_color_gd($img, $hex) Converts a hex triplet into a GD color. File core/modules/color/color.module, line 731 Allows users to change the color scheme of themes. Code function _color_gd($img, $hex) { $c = array_merge(array($img), _color_unpack($hex)); return call_user_func_array('imagecolorallocate', $c); }