Increases or decreases lightness by this percentage, returning new colour
Amount to change: 'fixed': a fixed amount 'delta': increase/decrease by this amount 'pdelta': proportion of current value to change by ('percentage delta')
const colour = { h: 0.5, s: 0.5, l: 0.5, space: `hsl`, unit: `scalar` };changeLightness(colour, { pdelta: 0.1 }); // l: 0.55changeLightness(colour, { delta: 0.1 }); // l: 0.6changeLightness(colour, { fixed: 0.5 }); // l: 0.5 Copy
const colour = { h: 0.5, s: 0.5, l: 0.5, space: `hsl`, unit: `scalar` };changeLightness(colour, { pdelta: 0.1 }); // l: 0.55changeLightness(colour, { delta: 0.1 }); // l: 0.6changeLightness(colour, { fixed: 0.5 }); // l: 0.5
Keep in mind the numerical value will depend on the unit of value. If it's scalar, lightness is 0..1 scale, otherwise 0..100 scale.
value
Use negative values to decrease (does not apply to 'fixed')
Hsl colour
Amount to change
Increases or decreases lightness by this percentage, returning new colour
Amount to change: 'fixed': a fixed amount 'delta': increase/decrease by this amount 'pdelta': proportion of current value to change by ('percentage delta')
Keep in mind the numerical value will depend on the unit of
value. If it's scalar, lightness is 0..1 scale, otherwise 0..100 scale.Use negative values to decrease (does not apply to 'fixed')