Color Palettes for Displays: Optimization by Genetic Algorithm

Color Palettes for Displays: Optimization by Genetic Algorithm John Rehling (rehling@cs.cmu.com) Human-Computer Interaction Institute School of Computer Science Carnegie Mellon University 5000 Forbes Avenue Pittsburgh, PA 15213 USA Introduction The use of color can make computer displays and interfaces more readable. Ideally, the colors in a display will be maximally different from one another. For small values of n, it is not difficult to choose instinctively colors that are clearly distinct from one another. For larger n, however, it becomes more difficult to assure that the colors are immediately distinguishable from one another. A genetic algorithm can be used to pick large sets of colors such that all pairs in the set are, according to one metric, nearly maximally distinguishable. Even allowing for imperfections in the scheme, these sets are in practical terms very easily distinguishable, and could be of use to designers. The approach The metric used for the differentiability between two colors is the CIE 1976 L*U*V* color space CITE. A genetic algorithm was used to find sets of colors that optimized a fitness function based on the CIE metric. With n as the number of colors being explored in a given run, an individual consisted of 3n values, represented as real numbers from 0 to 255, which is a twist from most GAs, which use strings of Boolean bits to represent individuals. The mutation operator, traditionally the toggling of a bit when bitstrings are the basis of the representation, is instead the alteration of a 0-255 value by adding to it a random number with a distribution with tails that ranged from –100 and 100 (but clustered tightly near the mode of zero). In each generation, the population would consist of the ten individuals rated highest by the fitness function, plus 45 copies of those individuals pass through the mutation operator, plus five new, random individuals. There was no breeding of individuals, since a set of colors is satisfactory only as a function of the whole set; except when n is very small, the cleaving together of two partial solutions is exceptionally unlikely to yield a good solution. After some trial and error, a fitness function was derived that consisted of the CIE distance between two two closest (i.e, least-easily distinguishable) pair of colors in the set plus a small constant (0.00001) times the sum of CIE distances between all pairs of colors in the set. This makes the first priority that no two colors in the set are very much alike; as a secondary priority, it also tries to maximize other separations between color pairs given that the worst pair has been dealt with. The genetic algorithm was run to find sets of colors for values of n from 2 to 12. In one set of runs, the colors were constrained only by what could appear on a typical computer monitor. In other sets of runs, it was required that black, white, or both black and white be included in the set of colors. Runs lasted until they appeared to converge upon a best value. At least three runs were conducted for each situation, with the best of all runs reported below. Results The printed form of the Proceedings is not the ideal medium for the presentation of the color palettes that the GA generated. The palettes are described here in terms of the R3 colors that most closely match the RGBs produced by the output. In many cases, the program produced values that differed slightly from any named color, although the differences from those listed below are almost always imperceptible. Unconstrained: n=2 {lime, magenta}; n=3 {red, lime, blue}; n=4 {red, yellow, aqua, magenta}; n=5 {deepPink, orange, lime, aqua, deepViolet}; n=6 {black, red, deepPink, orange, lime, blue} White plus: n=1 {red}; n=2 {red, lime}; n=3 {red, lime, blue}; n=4 {red, lime, teal, magenta} Black plus: n=1 {red}; n=2 {red, blue}; n=3 {red, lime, magenta}; n=4 {darkOrange, limeGreen, blue, magenta} Black, white plus: n=1 {red}; n=2 {red, lime}; n=3 {red, lime, blue}; n=4 {red, lime, blue, magenta} References Boff, K. and Lincoln, J., eds. (1987). Engineering Data Compendium: Human Perception and Performance. Dayton, Ohio: Armstrong Aerospace Medical Research Library.