Color Darken( float fraction )

book_4_sparkGenerated
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 return the original color, while a fraction of 1 will return 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.