Color Darken( float fraction )

robot_2Generated
code_blocksInput

Description

The Darken method is used to darken a color by a specified fraction. This method reduces the brightness of the color by decreasing its RGB components proportionally based on the given fraction. The alpha component remains unchanged.

Usage

To use the Darken method, call it on an instance of the Color struct, passing a float value between 0 and 1 as the fraction parameter. A fraction of 0 will leave the color unchanged, while a fraction of 1 will result in a completely black color.

Example

Color originalColor = new Color(0.5f, 0.5f, 0.5f, 1.0f);
float darkenFraction = 0.3f;
Color darkenedColor = originalColor.Darken(darkenFraction);
// darkenedColor will be a darker shade of the original color.