When you have a limited color palette (like in Minecraft), to achieve the impression of more colors, Dithering can be used.
This website gives a good explanation to the process involved:
https://shihn.ca/posts/2020/dithering/
Basically, the image's pixels are processed left-to-right, top-to-bottom, and if a pixel doesn't completely match a color from the available palette, the amount that doesn't match (the 'error') is distributed to the pixel's not yet processed neighbors.
All dithering algorithms vary at how much error goes to which not yet processed neighbors. Below is a summary between popular dithering algorithms:
https://tannerhelland.com/2012/12/28/dithering-eleven-algorithms-source-code.html
Basically, disregarding dithering algorithms that favor processing speed, do try these algorithms:
Mapartcraft only has a "Better Color option", which toggles between CIE76 (on) and Euclidian (off). The link below shows several algorithms:
https://en.wikipedia.org/wiki/Color_difference
Personally (mms0316), I've fiddled with the code from https://github.com/muak/ColorMinePortable, and CIEDE2000 can work better than CIE76, but I've also seen criticism on CIEDE2000. Also, Weighted Euclidian (naive) works for some images, but horribly wrong for others.
If you intend on going further and creating Pull Requests, the source code is here:
https://github.com/rebane2001/mapartcraft
The dithering and color difference algorithms are applied here:
https://github.com/rebane2001/mapartcraft/blob/master/src/components/mapart/workers/mapCanvas.jsworker
function squaredEuclideanMetricColours
returns the color difference, whether in the RGB color space (for Eucludian) or in the L*a*b*
color space (for CIE76 / "Better color").function findClosestColourSetIdAndToneAndRGBTo
returns the closest color according to a palette (colourSet.tonesRGB[toneKey]
)function findClosest2ColourSetIdAndToneAndRGBTo
is used only by Ordered and Bayer algorithms