To the R color experts:
I need to detect if a chosen background color (as hex e.g. #910322) is  
light or dark.
If it is dark I need to ovelay it with light text and vice versa.

Thus I would like to implement the following pseudo code:

if (brightness(color) > somevalue) textcolor= dark else textcolor=red

I am not too familiar with color systems. My idea was to convert the  
hex value to hsv / hsl space and extract the v or l value.
1) I am not sure if this is the way to go.
2) I do not succeed in it. convertColor {grDevices} or make.rgb  
{grDevices} did not help me with that. How can I convert hex to hsv/ 
hsl space

How would you detect the (perceived) color brightness?

Thanks
Mark

–––––––––––––––––––––––––––––––––––––––
Mark Heckmann
Dipl. Wirt.-Ing. cand. Psych.
Vorstraße 93 B01
28359 Bremen
Blog: www.markheckmann.de
R-Blog: http://ryouready.wordpress.com





        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to