Need Help with the compositor

I’m dumb in this kind of stuff but there is a function in a software called Asprite called “replace color” I don’t want this function but what come with it is a tolerance slider and when you increase the value the color that are closer to color you choose to replace well get replaced as well so what I’m asking is can I make in the compositor something similar to that when increasing the value the colors that are closer in hex value to each other’s well merged into one color or anyway to round the colors

https://docs.blender.org/manual/en/latest/compositing/types/color/posterize.html

its some how too much and not enough at the same time
Animation
what i needed is some thing like this

You can try something like this:

The color space (RBB, HSV, etc) used for the decomposition has a huge impact on the result.