ixfx
    Preparing search index...
    • 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.55
      changeLightness(colour, { delta: 0.1 }); // l: 0.6
      changeLightness(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.

      Use negative values to decrease (does not apply to 'fixed')

      Parameters

      • value: Hsl

        Hsl colour

      • amount: Partial<{ delta: number; fixed: number; pdelta: number }>

        Amount to change

      Returns Hsl