ColorHsv WithHue( float hue )

book_4_sparkGenerated
code_blocksInput

Description

The WithHue method allows you to create a new ColorHsv instance with a modified hue value while keeping the other components (saturation, value, and alpha) unchanged. This method is useful when you want to adjust the hue of a color without affecting its saturation, brightness, or transparency.

Usage

To use the WithHue method, call it on an existing ColorHsv instance and pass the desired hue value as a parameter. The hue value should be a float within the range of 0 to 360, representing the degree on the color wheel.

Example

// Create an initial ColorHsv instance
ColorHsv originalColor = new ColorHsv(120, 0.5f, 0.5f, 1.0f);

// Modify the hue of the original color
ColorHsv newColor = originalColor.WithHue(240);

// newColor now has a hue of 240, while saturation, value, and alpha remain unchanged