Hi! Absolutely love this library. I'm using it to auto generate tones for a color palette from a starting color using lch format. I'm running into issues with the fact that, say, adding 5 to the lightness of a color and then subtracting 5 does not produce the original color (I assume because of the way colord transitions through rgba). I'm wondering if there are currently any workarounds you can think of?
My general approach looks like this:
return shadeIndices.map((n) =>
colord({ l: l + lightnessTransformation(n), c: c + chromaTransformation(n), ...lch })
);
Where shadeIndices is an array of integers representing tones like [-2, -1, 0, 1, 2]. And lch is the rest of the lch object, doesn't include l and c.
Then, I provide an option to shift the starting lightness up or down.
Hi! Absolutely love this library. I'm using it to auto generate tones for a color palette from a starting color using
lch
format. I'm running into issues with the fact that, say, adding5
to the lightness of a color and then subtracting5
does not produce the original color (I assume because of the waycolord
transitions throughrgba
). I'm wondering if there are currently any workarounds you can think of?My general approach looks like this:
Where
shadeIndices
is an array of integers representing tones like[-2, -1, 0, 1, 2]
. Andlch
is the rest of thelch
object, doesn't includel
andc
.Then, I provide an option to shift the starting lightness up or down.