Nu/Nu.Math/Color.cs
/// <summary>
/// Clamp a color to the given minimum and maximum colors.
/// </summary>
/// <param name="color">Input color.</param>
/// <param name="min">Minimum color.</param>
/// <param name="max">Maximum color.</param>
/// <returns>The clamped color.</returns>
Clamp a color to the given minimum and maximum colors.
Clamp a color to the given minimum and maximum colors .
[Pure]
        public static Color Clamp(Color color, Color min, Color max)
        {
            color.R = color.R < min.R ? min.R : color.R > max.R ? max.R : color.R;
            color.G = color.G < min.G ? min.G : color.G > max.G ? max.G : color.G;
            color.B = color.B < min.B ? min.B : color.B > max.B ? max.B : color.B;
            color.A = color.A < min.A ? min.A : color.A > max.A ? max.A : color.A;
            return color;
        }
[ Pure ] public static Color Clamp ( Color color , Color min , Color max ) { color . R = color . R < min . R ? min . R : color . R > max . R ? max . R : color . R ; color . G = color . G < min . G ? min . G : color . G > max . G ? max . G : color . G ; color . B = color . B < min . B ? min . B : color . B > max . B ? max . B : color . B ; color . A = color . A < min . A ? min . A : color . A > max . A ? max . A : color . A ; return color ; }
Clamp a color to the given minimum and maximum colors.
Clamp a color to the given minimum and maximum colors .
The clamped color.
The clamped color .
color
Color
None
min
Color
None
max
Color
None