Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-generating palettes using LCH #120

Open
galenwinsor opened this issue Nov 21, 2023 · 0 comments
Open

Auto-generating palettes using LCH #120

galenwinsor opened this issue Nov 21, 2023 · 0 comments

Comments

@galenwinsor
Copy link

galenwinsor commented Nov 21, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant