@pbroom/color-kitManipulation

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.

functionimport { darken } from '@pbroom/color-kit';index.ts:51
function darken(  color: Color, ,  amount: number,): Color;

Parameters

colorColor
Color to darken
amountnumber
Fraction of the lightness to remove (0-1)

Returns

ColorA new Color

Example

TypeScript
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 }

See also