Re: [R] Selecting complementary colours

From: Earl F. Glynn <>
Date: Tue, 22 May 2007 11:20:33 -0500

"John Fox" <> 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 or


Earl F. Glynn
Stowers Institute for Medical Research mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue 22 May 2007 - 16:35:20 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 22 May 2007 - 17:31:08 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.