darken
Darken a color by scaling its OKLCH lightness toward black: l * (1 - amount), clamped to [0, 1]. Chroma, hue and alpha are unchanged, and the result is not gamut mapped.
import { darken } from '@pbroom/color-kit';index.ts:51function darken( color: Color, , amount: number,): Color;Parameters
- amount
number - Fraction of the lightness to remove (
0-1)
Returns
ColorA new Color
Example
import { darken, parse } from '@pbroom/color-kit';
darken(parse('oklch(0.6 0.1 250)'), 0.5); // → { l: 0.3, c: 0.1, h: 250, alpha: 1 }