CUE.NET.Helper.ColorHelper.GetHSVSaturation C# (CSharp) Method

GetHSVSaturation() public static method

Gets the saturation-value (HSV-color space) of the color.
public static GetHSVSaturation ( this color ) : float
color this The color to take the saturation from.
return float
        public static float GetHSVSaturation(this CorsairColor color)
        {
            int max = Math.Max(color.R, Math.Max(color.G, color.B));
            int min = Math.Min(color.R, Math.Min(color.G, color.B));

            // ReSharper disable RedundantCast - never trust this ...
            return (max == 0) ? 0 : 1f - ((float)min / (float)max);
            // ReSharper restore RedundantCast
        }