Yea, it's 100% niche - 1 stupid user (me), I've painted many new sprites using arbitrary rgb colors "just for now, to see how it look".
Then it turned to look really good but sprites were using out of production palette colors
How does "RGB least square diff " work?
I meant, for every
x,y cell on active
layer, separately for background and foreground, we're looking for such palette
index (0-255) on active
palette which results in smallest color error given by:
int ColorDiff(uint8 rgb1[3], uint8 rgb2[3])
{
static const int w[3] = {3,4,1}; // human is less sensitive to blue changes, this could be configurable
int dr = rgb1[0] - rgb2[0]; // per channel difference
int dg = rgb1[1] - rgb2[1];
int db = rgb1[2] - rgb2[2];
return w[0]*dr*dr + w[1]*dg*dg + w[2]*db*db; // weighted sum of square diffs
}
Of course I've fixed my mistake outside of RP, so it is not must have feature in RP.