Skip to content

swapping color palettes #47

@remmycat

Description

@remmycat

(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.

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