Skip to content

Function: setLightness()

ts
function setLightness(color, lightness): Color;

Defined in: setLightness.ts:15

Set the lightness value for a color to a specific value.

Parameters

ParameterTypeDescription
colorColorthe color to set the value for
lightnessstring | numbera number or string representing lightness. Numbers >= 1 are treated as a percentage (0–100). Numbers < 1 are treated as a ratio (0–1). Percentage strings are also accepted (e.g. "50%").

Returns

Color

a new color with the new lightness value