saturate
Increase chroma by an absolute fraction of the OKLCH chroma range: adds amount * 0.4, clamped below at 0. Note this is not the relative scaling that desaturate applies. Like lighten, only the channel's own domain is enforced: chroma has no upper bound, so wide-gamut colors (Display P3, Rec. 2020) keep or gain chroma beyond 0.4. The result is not gamut mapped; pass it to toSrgbGamut or toP3Gamut to fit a display.
import { saturate } from '@pbroom/color-kit';index.ts:88function saturate( color: Color, , amount: number,): Color;Parameters
- amount
number - Fraction of the
0-0.4chroma range to add (negative values remove chroma)
Returns
ColorA new Color
Example
import { parse, saturate } from '@pbroom/color-kit';
saturate(parse('oklch(0.7 0.1 250)'), 0.25); // → { l: 0.7, c: 0.2, h: 250, alpha: 1 }
saturate(parse('oklch(0.85 0.36 145)'), 0.25).c; // → ≈ 0.46 (not capped at 0.4)