Color Saturate( float fraction )

book_4_sparkGenerated
code_blocksInput

Description

The Saturate method in the Color struct is used to increase the saturation of a color by a specified fraction. Saturation refers to the intensity or purity of a color. Increasing saturation makes colors appear more vivid, while decreasing it makes them appear more washed out or gray.

Usage

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.

For example, if you have a color and you want to increase its saturation by 50%, you would pass 0.5 as the fraction.

Example

Color myColor = new Color(0.5f, 0.4f, 0.3f, 1.0f);
Color saturatedColor = myColor.Saturate(0.5f);
// This will increase the saturation of myColor by 50%.