Skip to content

Auto-generating palettes using LCH #120

@galenwinsor

Description

@galenwinsor

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions