gamut_map
Convert any CSS color to a displayable sRGB value by reducing OKLCH chroma, returning the nearest in-gamut hex with a flag for out-of-gamut inputs.
Instructions
Map any CSS color string into the sRGB gamut via perceptual OKLCH chroma reduction. Returns the nearest in-gamut hex, raw OKLCH components, and a clamped flag indicating whether the input was out-of-gamut.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes | Any CSS color string, e.g. "#ff0000", "oklch(0.6 0.4 30)" (max 256 chars) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hex | Yes | Lowercase #rrggbb of the gamut-mapped (in-sRGB) color | |
| oklch | Yes | Raw (pre-rounding) OKLCH components of the mapped result | |
| clamped | Yes | true when input was out-of-sRGB-gamut and was mapped |