Skip to content

@jsvision/core / lighten

Function: lighten()

lighten(color, amount): Color

Defined in: color/ramp.ts:133

Lighten a color by raising its OKLab lightness.

Hue and chroma are preserved; only perceptual lightness moves, clamped to the [0,1] range (so lightening an already-white color is a no-op).

Parameters

color

Color

A resolvable color — not 'default'.

amount

number

OKLab-lightness increase, 0..1 (e.g. 0.2 for a hover state).

Returns

Color

The lightened color as #rrggbb.

Throws

InvalidColorError when color is unresolvable.

Example

ts
import { lighten } from '@jsvision/core';

lighten('#3b82f6', 0.2); // a lighter blue, same hue