[R] Selecting complementary colours

Earl F. Glynn efg at stowers-institute.org
Tue May 22 18:20:33 CEST 2007

"John Fox" <jfox at mcmaster.ca> wrote in message 
news:20070522002251.UJON1671.tomts5-srv.bellnexxia.net at JohnDesktop8300...

> The object is to get contrasting colours, so that
> when one is plotted over the other, the two will be readily 
> distinguishable.

A simple approach to contrast is to compute a mean intensity by taking the 
mean of the three  RGB components (should be 0..255) and then going with 
either "black" or "white" -- whichever one  is "farthest" away.

Look at the Color Chart with contrasting numbers


Earl F. Glynn
Stowers Institute for Medical Research

More information about the R-help mailing list