Color WithBlue( float blue )

book_4_sparkGenerated
code_blocksInput

Description

The WithBlue method allows you to create a new Color instance with a modified blue component, while keeping the other components (red, green, and alpha) unchanged. This method is useful when you want to adjust the blue intensity of a color without affecting its other properties.

Usage

To use the WithBlue method, call it on an existing Color instance and pass the desired blue component value as a float between 0 and 1. The method returns a new Color instance with the updated blue component.

Example

// Example of using the WithBlue method
Color originalColor = new Color(0.5f, 0.5f, 0.5f, 1.0f); // A gray color
Color newColor = originalColor.WithBlue(0.8f); // Adjusts the blue component to 0.8

// newColor now has the same red, green, and alpha as originalColor, but with a blue component of 0.8