I have a web page I have designed with a specific color scheme, and I want to have 4 specific colors from that scheme to be the only hues present in my images. Essentially, I want to collapse four ranges of hues to four discrete hues. Within one hue I want to maintain the existing tints/brightness variation.
I would like to perform this shift using CSS filters.
I believe I would use feColorMatrix or feComponenentTransfer, however I cannot find an example that shows how to do this kind of shift with 4 or more colors (I only see examples of shifting rgb to either 2 colors, or shifting individually red, green, and blue, so that you go from a certain three color structure to a different three color distribution).
I would like to shift the images so that they only contains these 4 hues:
rgb(82, 79, 161)
rgb(0, 173, 220)
rgb(242,235,22)
rgb(183, 36, 103)
To clarify, this is a visual representation about I would like to see things shift:
You can use this example image:
Here's some basic code/snippet to get you started:
.four_colors {
/*insert filter here */
}
<img class ="four_colors" src="https://i.sstatic.net/FGKUX.png">
If you can help, I'd appreciate it greatly!