Function withHue
Returns a copy of an OKLCH value with raw stored hue replaced.
Lightness and chroma are preserved exactly. The supplied hue is stored without normalization, wrapping, chroma adjustment, clipping, or gamut mapping.
Parameters
| Name | Description |
|---|---|
| color | Source OKLCH value. |
| hue | Raw replacement Oklab-family hue. |
Returns
A copy of color with only hue replaced.
See Also
withLightness, withChroma
Example
enum color = Oklchd(
0.55,
0.12,
OklabHued .fromDegrees(250.0)
);
enum changed =
color .withHue(
OklabHued .fromDegrees(725.0)
);
static assert(changed .l == color .l);
static assert(changed .c == color .c);
static assert(changed .h .rawDegrees == 725.0);