There are several major systems for defining color, each well-suited to different needs. RGB is the default for computer screens; each pixel is basically made up of a red, green, and blue LED. CMYK (cyan, magenta, yellow, black) are the ink colors which produce the best gamut for printers. CIE XYZ accounts for the green-dominance in human sight.
For me and Neko, hue is central. Hue is the relationship between primaries— a pale cherry red and a dark cherry red share a hue. I found this little algorithm for converting RGB is HSV (hue, saturation/white, value/black), and wanted to make a note of it for the future.
// r,g,b values are from 0 to 1
// h = [0,360], s = [0,1], v = [0,1]
// if s == 0, then h = -1 (undefined)
void RGBtoHSV( float r, float g, float b, float *h, float *s, float *v )
{
float min, max, delta;
min = MIN( r, g, b );
max = MAX( r, g, b );
*v = max; // v
delta = max - min;
if( max != 0 )
*s = delta / max; // s
else {
// r = g = b = 0 // s = 0, v is undefined
*s = 0;
*h = -1;
return;
}
if( r == max )
*h = ( g - b ) / delta; // between yellow & magenta
else if( g == max )
*h = 2 + ( b - r ) / delta; // between cyan & yellow
else
*h = 4 + ( r - g ) / delta; // between magenta & cyan
*h *= 60; // degrees
if( *h < 0 )
*h += 360;
}
Once I have completed Neko's new set of pigment swatches, I will assign each pigment to a specific hue. When Neko has a target digital hue, he can refer to that database to find the closest pigments. Our color system is also growing in text references to each pigment, so word associations can be made as well.
Edit 4/23: Found this comprehensive color system website today.