Color Lighten( float fraction )

robot_2Generated
code_blocksInput

Description

The Lighten method is used to increase the brightness of a color by a specified fraction. This method adjusts the color's RGB components to make it lighter, while keeping the alpha component unchanged. The fraction parameter determines how much the color should be lightened, with a value of 0 resulting in no change and a value of 1 resulting in a fully white color.

Usage

To use the Lighten method, call it on an instance of the Color struct, passing a float value as the fraction by which you want to lighten the color. The fraction should be between 0 and 1.

Example

// Example of using the Lighten method
Color originalColor = new Color(0.5f, 0.5f, 0.5f, 1.0f); // A medium gray color
float lightenFraction = 0.2f; // Lighten by 20%
Color lightenedColor = originalColor.Lighten(lightenFraction);

// lightenedColor will now be a lighter shade of gray