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

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

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

API

Valeur de retour

La valeur retournée par cet util.

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

Usage

Exemples

Extraits de code prêts à coller.

Darken a primary colour

typescript