darken

Commons
stable

Darkens an RGBA colour by reducing its CIE L* lightness in CIELAB space by amount × 10. Returns the modified RGBA without mutating the input.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

value
required
TRGBA
The source colour as an RGBA tuple [r, g, b, a] with channels in [0, 255] except alpha in [0, 1].
amount
required
number
The darkening step. Each unit reduces L* by 10. Use values between 0.5 and 3 for typical tonal shifts.

API

Return value

The value returned by this util.

A new RGBA tuple with the reduced lightness. The original is not mutated.

Usage

Examples

Ready-to-paste usage snippets.

Darken a primary colour

typescript