function _color_hue2rgb

Same name in other branches
  1. 7.x modules/color/color.module \_color_hue2rgb()
  2. 9 core/modules/color/color.module \_color_hue2rgb()

Helper function for _color_hsl2rgb().

1 call to _color_hue2rgb()
_color_hsl2rgb in core/modules/color/color.module
Converts an HSL triplet into RGB.

File

core/modules/color/color.module, line 811

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.