private static function hueToRgb($p, $q, $hue): float
    {
        if ($hue < 0) {
            $hue += 1;
        }
        if ($hue > 1) {
            $hue -= 1;
        }

        if ($hue < 1 / 6) {
            return $p + ($q - $p) * 6 * $hue;
        }
        if ($hue < 1 / 2) {
            return $q;
        }
        if ($hue < 2 / 3) {
            return $p + ($q - $p) * (2 / 3 - $hue) * 6;
        }

        return $p;
    }
private static function hueToRgb($p, $q, $hue): float
    {
        if ($hue < 0) {
            $hue += 1;
        }
        if ($hue > 1) {
            $hue -= 1;
        }

        if ($hue < 1 / 6) {
            return $p + ($q - $p) * 6 * $hue;
        }
        if ($hue < 1 / 2) {
            return $q;
        }
        if ($hue < 2 / 3) {
            return $p + ($q - $p) * (2 / 3 - $hue) * 6;
        }

        return $p;
    }
private static function hueToRgb ( $ p , $ q , $ hue ) : float { if ( $ hue < 0 ) { $ hue += 1 ; } if ( $ hue > 1 ) { $ hue -= 1 ; } if ( $ hue < 1 / 6 ) { return $ p + ( $ q - $ p ) * 6 * $ hue ; } if ( $ hue < 1 / 2 ) { return $ q ; } if ( $ hue < 2 / 3 ) { return $ p + ( $ q - $ p ) * ( 2 / 3 - $ hue ) * 6 ; } return $ p ; }
Converts an HSL hue to it's RGB value.

Thanks to Easy RGB for this function (Hue_2_RGB).
http://www.easyrgb.com/index.php?X=MATH&$h=19#text19
http://stackoverflow.com/questions/2353211/hsl-to-rgb-color-conversion

@param float $p   Temporary based on whether the luminance is less than 0.5, and
calculated using the saturation and luminance values.
@param float $q
@param float $hue The hue (to be converted to an RGB value)  For red, add 1/3 to the hue, green
leave it alone, and blue you subtract 1/3 from the hue.

@return mixed
Converts an HSL hue to it s RGB value .