function _color_hsl2rgb
Same name in other branches
- 7.x modules/color/color.module \_color_hsl2rgb()
- 9 core/modules/color/color.module \_color_hsl2rgb()
Converts an HSL triplet into RGB.
1 call to _color_hsl2rgb()
- _color_shift in core/
modules/ color/ color.module - Shifts a given color, using a reference pair and a target blend color.
File
-
core/
modules/ color/ color.module, line 794
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 [
_color_hue2rgb($m1, $m2, $h + 0.33333),
_color_hue2rgb($m1, $m2, $h),
_color_hue2rgb($m1, $m2, $h - 0.33333),
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.