On Thu, 7 Apr 2005, Earl F. Glynn wrote:
For example, R already provides both hsv() and rgb() to create colours
from vectors of three numbers, but the correspondence is different in each
case.

Sorry if some consider this off topic: HSV as a color space is really only liked by computer scientists. Image processing and color engineers rarely if ever use HSV.

There are MANY other color spaces and computations possible (see "color
spaces" or "color conversions" or other color topics on  this page
http://www.efg2.com/Lab/Library/Color/Science.htm).  Most of these color
manipulations in R are not easy because the very first step, converting
colors, I mean numbers <g>, like #ff0080 to the red, green components is
hindered because one must reinvent the wheel of hex-to-decimal conversion.

Yes, and convertColor in R-devel does quite a few of these (XYZ tristimulus space; CIE Lab and Luv; sRGB, Apple RGB and roll-your-own RGB based on chromaticities of the primaries; and chromatic adaptation for changing the white point). The "colorspace" package has a more elegant implementation of a somewhat different set of color space computations, and R-devel also has hcl() for specifying colors based on hue, chroma, and luminance (polar coordinates in Luv space).


Basing R graphics on these (and so making them colours rather than just data about colours) requires a further step of considering the characteristics of the output device. This might be as simple as declaring R's output to be sRGB or as complicated as worrying about ICC profiles.

        -thomas

______________________________________________
R-help@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

Reply via email to