The Saturate
method of the Color
struct is used to increase the saturation of a color by a specified fraction. Saturation refers to the intensity or purity of the color. Increasing saturation makes colors more vivid, while decreasing it makes them more muted.
To use the Saturate
method, call it on an instance of the Color
struct, passing a float
value as the fraction
parameter. This value should be between 0 and 1, where 0 means no change and 1 means full saturation.
Example usage:
Color myColor = new Color(0.5f, 0.5f, 0.5f, 1.0f);
Color saturatedColor = myColor.Saturate(0.2f);
In this example, myColor
is a gray color, and saturatedColor
will be a more vivid version of myColor
with 20% increased saturation.