Frage

I have many different colors in stylus. I would like to transform this colors to a lightning of 220 (I would like to lighten the color). I can't use lighten because it will change the lightning component relative to it's initial value, so colors that had not a lot of lightning will still have more than the one who did'nt have some.

Is they a built in function or a way to do this ?

War es hilfreich?

Lösung

There was actually some debate about whether stylus should lighten colors relatively to their luminosity or just "add white" on top of it.

Anyway, you want to replace the luminance value in the hsl scale, so you can decompose your color and only keep the hue and saturation, and force the luminance value you want:

c = #123;
n = hsl(hue(c), saturation(c), 86);

Here 86 is a percentage.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top