Posted July 11, 2011 at 23:57 in Colors, Graphics, Illustrator, Scriptographer - Say something

I have been looking for ways to mathematically convert RGB colors to other color standards. My intention is to create some script or routine that would, either automagically or manually, make it easier to pick similar colors out of a predefined one. My first thought was that the HSB standard would be a good choice but forum posts pointed to Lab instead. A quick google later I found EasyRGB, which came very much in handy. The people over there have a long list of functions in a generic programming language for converting between several (if not all) of the most common color standards.

Much to my joy, they also listed a function for calculating ΔE, color difference. More on this subject can be read in this Wikipedia article. Lets just say that I went with the CIE94 (or Delta E 1994 or ΔE94, there doesn’t seem be a formal name for it).

Apparently, to calculate ΔE, RGB has to be converted to the CIE-L*CH° standard. This must be done in several steps; RGB -> XYZ -> CIE-L*ab -> CIE-L*CH°. Kinda tedious…

The picture below is showing different pairs of green shades with each colors RGB value listed at the top and ΔE centered at the bottom of each pair. To quote Wikipedia: “In theory, a ΔE of under 1.0 is supposed to be indistinguishable unless the samples are adjacent to one another.”

As of now, I haven’t yet figured out how to pick new colors. A random pick will yield too many iterations until a suitable color is found. This, however is a small matter. The real challenge will be to come up with a script that would benefit from this.