[R] Selecting complementary colours
Ken Knoblauch
knoblauch at lyon.inserm.fr
Tue May 22 10:07:38 CEST 2007
Hi John and all,
I'm getting into this late and I think that most of the bases have been
touched. But just to dot some "eyes",...
Some years ago, I proposed some general rules of thumb that should help
in generating optimally contrasting text for nearly anyone, that have been
distilled into a few simple rules at this website.
http://www.lighthouse.org/accessibility/effective-color-contrast/
A basic part of the guidelines include maximizing luminance contrast.
Mike Kubovy, is absolutely correct that iso- or equiluminant colors would be
difficult to detect because the chromatic systems in the eye are spatially
low pass, though chromatic aberration would tend to work against this
for large text a little bit by adding some luminance transients at the edges.
If your viewer happens to be a garden variety dichromat (protanope or
deuteranope), then you have to worry about choosing colors along one
of his confusion lines. For example, for a deuteranope, there exists
equiluminant magenta and cyan that appear gray, so these would
generate an invisible contrast for the observer (maybe some outline
would be vaguely visible because of chromatic aberrations in the eye).
It's a little different for the protanope because he (and it is mostly he's)
has a luminosity loss, so his confusion line is not in an equiluminant plane.
Early stages of some prevalent eye diseases can produce a different
type of chromatic loss, in which violet vs yellow-green contrasts are
difficult to detect.
Colorimetrically, complementaries are defined as pairs of lights whose
additive
mixture matches a reference white. So, according to the definition,
either gray is its own complementary, or a null light would also qualify.
To arbitrarily generate true complementaries would require the lights to be
specified in an additive system. So, if you wanted
colorimetrically precise complementaries, you would need to have
your screen/printer calibrated.
HTH,
Ken
*********************************
Hi All,
Complementary colors will not insure legibility. If the text and the
background are equiluminant, visibility will be severely impaired.
On May 21, 2007, at 8:22 PM, John Fox wrote:
> Dear Achim,
>
> As I mentioned in my response to Deepayan's suggestion, I didn't
> specify the
> original problem clearly: The object is to get contrasting colours,
> so that
> when one is plotted over the other, the two will be readily
> distinguishable.
> Your suggestions don't do this for neutral colours:
>
>> x <- "#888888"
>> y_hcl <- as(hex2RGB(x), "polarLUV")
>> y_hcl at coords[1, "H"] <- y_hcl at coords[1, "H"] + 180
>> hex(y_hcl)
> [1] "#888888"
>
>> y_hsv <- as(hex2RGB(x), "HSV")
>> y_hsv at coords[1, "H"] <- y_hsv at coords[1, "H"] + 180
>> hex(y_hsv)
> [1] "#888888"
>
> Thank you for trying to help.
>
> John
>
> --------------------------------
> John Fox, Professor
> Department of Sociology
> McMaster University
> Hamilton, Ontario
> Canada L8S 4M4
> 905-525-9140x23604
> http://socserv.mcmaster.ca/jfox
> --------------------------------
>
>> -----Original Message-----
>> From: Achim Zeileis [mailto:Achim.Zeileis at wu-wien.ac.at]
>> Sent: Monday, May 21, 2007 7:07 PM
>> To: John Fox
>> Cc: r-help at stat.math.ethz.ch
>> Subject: Re: [R] Selecting complementary colours
>>
>> On Mon, 21 May 2007, John Fox wrote:
>>
>>> Dear r-helpers,
>>>
>>> I wonder whether, given the "#rrggbb" representation of a colour,
>>> there is a simple way to select the complementary colour,
>> also expressed as a "#rrggbb"
>>> string.
>>
>> Is the complementary color uniquely defined? My understanding
>> is that you can take opposite colors on a color wheel, but
>> there are of course various color wheels available. With
>> "colorspace" you can experiment with this,
>> e.g.:
>> x <- "#81A9D0"
>> y_hcl <- as(hex2RGB(x), "polarLUV")
>> y_hcl at coords[1, "H"] <- y_hcl at coords[1, "H"] + 180
>> y_hcl <- hex(y_hcl)
>> which is a bit more balanced than
>> y_hsv <- as(hex2RGB(x), "HSV")
>> y_hsv at coords[1, "H"] <- y_hsv at coords[1, "H"] + 180
>> y_hsv <- hex(y_hsv)
>>
>> hth,
>> Z
>>
>>
>>
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.
_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400 Charlottesville, VA 22904-4400
Parcels: Room 102 Gilmer Hall
McCormick Road Charlottesville, VA 22903
Office: B011 +1-434-982-4729
Lab: B019 +1-434-982-4751
Fax: +1-434-982-4766
WWW: http://www.people.virginia.edu/~mk9y/
--
Ken Knoblauch
Inserm U846
Institut Cellule Souche et Cerveau
Département Neurosciences Intégratives
18 avenue du Doyen Lépine
69500 Bron
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: +33 (0)6 84 10 64 10
http://www.pizzerialesgemeaux.com/u846/
More information about the R-help
mailing list