Skip to content

Navigation Menu

Sign in
Sign up

swapping color palettes #47

Open
Open

Description

(feature suggestion)
For one of my projects i drew images with a fixed color palette which i want to be able to change on the fly. I kind of hacked this in by allowing matchPalette to accept another palette so that, after matching, it takes the colors of the second and not the first palette.

Example:
We have an image with a palette of three different colors ('#aaa', '#bbb', '#ccc').
Now we run

cq(image).matchPalette(['#aaa', '#bbb', '#ccc'], ['#f00', '#0f0', '#00f'])

And the returned image uses the second palette where '#aaa' was replaced by '#f00' etc.
Now, the way i did it was rather dirty and assumes that both palettes have the same length, maybe you can find a nicer way.

tl;dr: It would be cool to have a nice way to swap color palettes of an image.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      AltStyle によって変換されたページ (->オリジナル) /