public function toHSL($red, $green, $blue)
    {
        $min = min($red, $green, $blue);
        $max = max($red, $green, $blue);

        $l = $min + $max;
        $d = $max - $min;

        if ((int) $d === 0) {
            $h = $s = 0;
        } else {
            if ($l < 255) {
                $s = $d / $l;
            } else {
                $s = $d / (510 - $l);
            }

            if ($red == $max) {
                $h = 60 * ($green - $blue) / $d;
            } elseif ($green == $max) {
                $h = 60 * ($blue - $red) / $d + 120;
            } elseif ($blue == $max) {
                $h = 60 * ($red - $green) / $d + 240;
            }
        }

        return [Type::T_HSL, fmod($h, 360), $s * 100, $l / 5.1];
    }
public function toHSL($red, $green, $blue)
    {
        $min = min($red, $green, $blue);
        $max = max($red, $green, $blue);

        $l = $min + $max;
        $d = $max - $min;

        if ((int) $d === 0) {
            $h = $s = 0;
        } else {
            if ($l < 255) {
                $s = $d / $l;
            } else {
                $s = $d / (510 - $l);
            }

            if ($red == $max) {
                $h = 60 * ($green - $blue) / $d;
            } elseif ($green == $max) {
                $h = 60 * ($blue - $red) / $d + 120;
            } elseif ($blue == $max) {
                $h = 60 * ($red - $green) / $d + 240;
            }
        }

        return [Type::T_HSL, fmod($h, 360), $s * 100, $l / 5.1];
    }
public function toHSL ( $ red , $ green , $ blue ) { $ min = min ( $ red , $ green , $ blue ) ; $ max = max ( $ red , $ green , $ blue ) ; $ l = $ min + $ max ; $ d = $ max - $ min ; if ( ( int ) $ d === 0 ) { $ h = $ s = 0 ; } else { if ( $ l < 255 ) { $ s = $ d / $ l ; } else { $ s = $ d / ( 510 - $ l ) ; } if ( $ red == $ max ) { $ h = 60 * ( $ green - $ blue ) / $ d ; } elseif ( $ green == $ max ) { $ h = 60 * ( $ blue - $ red ) / $ d + 120 ; } elseif ( $ blue == $ max ) { $ h = 60 * ( $ red - $ green ) / $ d + 240 ; } } return [ Type :: T_HSL , fmod ( $ h , 360 ) , $ s * 100 , $ l / 5.1 ] ; }
Convert RGB to HSL

@api

@param integer $red
@param integer $green
@param integer $blue

@return array
Convert RGB to HSL