OKLCH Chroma Clamp sRGB Max
Search first radial sRGB-gamut boundary at fixed OKLCH L/h up to requested chroma using 512 scan steps and 48 bisections, preserving hue/lightness within matrix tolerance; numerical first-crossing clamp, not a global CSS gamut-map implementation or exact maximum over disconnected gamut intervals.
Description
A fixed-lightness/hue OKLCH radial search can reduce requested chroma to the first sampled sRGB boundary.
A fixed-lightness/hue OKLCH radial search can reduce requested chroma to the first sampled sRGB boundary. The procedure is numerical.1, 2
Enter lightness 0–1, finite hue bounded±10^9 degrees and chroma 0–1. Normalize hue; use a 1 e−10 linear-gamut tolerance. Endpoint lightness 0/1 returns black/white with zero chroma. Return accepted chroma, clamped encoded RGB and reduction flag.
When to use OKLCH Chroma Clamp sRGB Max
Use OKLCH Chroma Clamp sRGB Max when you need to evaluate the supplied records under the calculation and evidence rules below. No global maximum over disconnected radial intervals or complete CSS gamut-mapping implementation is supplied.
Prepare colors in the stated color space and scale. Use encoded RGB fractions, linear RGB, Lab, xy, byte values or ink percentages exactly as requested; supply caller tolerances and reference conditions.
How to use OKLCH Chroma Clamp sRGB Max and understand its results
- Prepare colors in the stated color space and scale. Use encoded RGB fractions, linear RGB, Lab, xy, byte values or ink percentages exactly as requested; supply caller tolerances and reference conditions.
- Enter okLightnessFraction, okHueDegrees, requestedChroma using the field table and calculation rules, then run the tool.
- Read clampedChroma, clampedEncodedSrgb, chromaReduced. The explanation below defines the units, signs, ordering and any flags or placeholder values.
- If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
| Input field | Meaning | Value type; see rules below | Requirement |
|---|---|---|---|
| okLightnessFraction | Ok lightness fraction | number | Required |
| okHueDegrees | Ok hue degrees | number | Required |
| requestedChroma | Requested chroma | number | Required |
Enter lightness 0–1, finite hue bounded±10^9 degrees and chroma 0–1. Normalize hue; use a 1 e−10 linear-gamut tolerance. Endpoint lightness 0/1 returns black/white with zero chroma. Return accepted chroma, clamped encoded RGB and reduction flag.
scan512 chroma steps; bisect first failing bracket48 times Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.
| Output field | Meaning | Value type |
|---|---|---|
| clampedChroma | Clamped chroma | number |
| clampedEncodedSrgb | Clamped encoded srgb | list of number |
| chromaReduced | Chroma reduced | boolean |
{
"input": {
"okLightnessFraction": 0,
"okHueDegrees": 0,
"requestedChroma": 0.2
},
"output": {
"clampedChroma": 0,
"clampedEncodedSrgb": [
0,
0,
0
],
"chromaReduced": true
}
} Limitations and assumptions
No global maximum over disconnected radial intervals or complete CSS gamut-mapping implementation is supplied.
Numeric inputs, where present, must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors. A successfully returned false flag is an evaluated outcome; its meaning is explained above.
Alternative or Complementary methods
Use sRGB Gamut RGB Bounds Checker: Unclipped linear RGB channels expose gamut excursions. A small caller tolerance handles numerical boundary noise. For a complementary task, use Display-P3 Out-of-Gamut Flagger: Display-P 3 covers colors outside sRGB. Transforming to unclipped linear sRGB preserves that evidence.
Further background: CSS Color Module Level 4.
References
-
OKLCH Chroma Clamp sRGB Max — tool.io
-
CSS Color Module Level 4 — World Wide Web Consortium
Similar or alternative tools
- sRGB Gamut RGB Bounds Checker
Unclipped linear RGB channels expose gamut excursions. A small caller tolerance handles numerical boundary noise.
- Display-P3 Out-of-Gamut Flagger
Display-P 3 covers colors outside sRGB. Transforming to unclipped linear sRGB preserves that evidence.