Phrozn/Vendor/Extra/scss.inc.php
function toRGB($H, $S, $L) {
        $H = $H % 360;
        if ($H < 0) $H += 360;

        $S = min(100, max(0, $S));
        $L = min(100, max(0, $L));

        $H = $H / 360;
        $S = $S / 100;
        $L = $L / 100;

        if ($S == 0) {
            $r = $g = $b = $L;
        } else {
            $temp2 = $L < 0.5 ?
                $L*(1.0 + $S) :
                $L + $S - $L * $S;

            $temp1 = 2.0 * $L - $temp2;

            $r = $this->toRGB_helper($H + 1/3, $temp1, $temp2);
            $g = $this->toRGB_helper($H, $temp1, $temp2);
            $b = $this->toRGB_helper($H - 1/3, $temp1, $temp2);
        }

        $out = array('color', $r*255, $g*255, $b*255);
        return $out;
    }
function toRGB($H, $S, $L) {
        $H = $H % 360;
        if ($H < 0) $H += 360;

        $S = min(100, max(0, $S));
        $L = min(100, max(0, $L));

        $H = $H / 360;
        $S = $S / 100;
        $L = $L / 100;

        if ($S == 0) {
            $r = $g = $b = $L;
        } else {
            $temp2 = $L < 0.5 ?
                $L*(1.0 + $S) :
                $L + $S - $L * $S;

            $temp1 = 2.0 * $L - $temp2;

            $r = $this->toRGB_helper($H + 1/3, $temp1, $temp2);
            $g = $this->toRGB_helper($H, $temp1, $temp2);
            $b = $this->toRGB_helper($H - 1/3, $temp1, $temp2);
        }

        $out = array('color', $r*255, $g*255, $b*255);
        return $out;
    }
function toRGB ( $ H , $ S , $ L ) { $ H = $ H % 360 ; if ( $ H < 0 ) $ H += 360 ; $ S = min ( 100 , max ( 0 , $ S ) ) ; $ L = min ( 100 , max ( 0 , $ L ) ) ; $ H = $ H / 360 ; $ S = $ S / 100 ; $ L = $ L / 100 ; if ( $ S == 0 ) { $ r = $ g = $ b = $ L ; } else { $ temp2 = $ L < 0.5 ? $ L * ( 1.0 + $ S ) : $ L + $ S - $ L * $ S ; $ temp1 = 2.0 * $ L - $ temp2 ; $ r = $ this -> toRGB_helper ( $ H + 1 / 3 , $ temp1 , $ temp2 ) ; $ g = $ this -> toRGB_helper ( $ H , $ temp1 , $ temp2 ) ; $ b = $ this -> toRGB_helper ( $ H - 1 / 3 , $ temp1 , $ temp2 ) ; } $ out = array ( 'color' , $ r * 255 , $ g * 255 , $ b * 255 ) ; return $ out ; }
H from 0 to 360, S and L from 0 to 100
H from 0 to 360 S and L from 0 to 100