The Lighten
method is used to increase the brightness of a color by a specified fraction. This method adjusts the RGB components of the color, making it lighter while maintaining the same hue and saturation. The alpha component remains unchanged.
The Lighten
method is used to increase the brightness of a color by a specified fraction. This method adjusts the RGB components of the color, making it lighter while maintaining the same hue and saturation. The alpha component remains unchanged.
To use the Lighten
method, call it on an instance of the Color
struct, passing a float
value as the fraction
parameter. The fraction
should be a value between 0 and 1, where 0 means no change and 1 means the color is fully lightened to white.
// 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 now represents a lighter shade of the original color