Tests and selects the correct formula for each RGB color channel

Paramètres

$v1:

$v2:

$vh:

Return value

mixed

1 call to CSSmin::hueToRgb()
CSSmin::hslToRgb dans advagg_css_compress/yui/CSSMin.inc
Converts a HSL color into a RGB color

Fichier

advagg_css_compress/yui/CSSMin.inc, line 1145

Classe

CSSmin

Code

private function hueToRgb($v1, $v2, $vh) {
    $vh = $vh < 0 ? $vh + 1 : ($vh > 1 ? $vh - 1 : $vh);
    if ($vh * 6 < 1) {
        return $v1 + ($v2 - $v1) * 6 * $vh;
    }
    if ($vh * 2 < 1) {
        return $v2;
    }
    if ($vh * 3 < 2) {
        return $v1 + ($v2 - $v1) * (2 / 3 - $vh) * 6;
    }
    return $v1;
}