Re:physical colors and Mathematica colors

*To*: mathgroup at smc.vnet.net*Subject*: [mg26418] Re:[mg26392] physical colors and Mathematica colors*From*: "Ersek, Ted R" <ErsekTR at navair.navy.mil>*Date*: Wed, 20 Dec 2000 00:21:40 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

Preston Nichols wrote: I am working on a package for which I need a function which takes a wavelength of light (in nanometers, for example) and returns an RGBColor specification. Has anyone made such a function for Mathematica? Of course, it is not essential that the result be RGBColor; any other standard computer-graphics color model would do the job (HSB, HLS, CMY, CMYK, etc.), because the conversions are standard. It's only the conversion between one of these and physical wavelengths which I don't know. ------------------- As you explore different regions of Hue[h,s,b], RGBColor[r,g,b] you might find my ColorPlot Mathematica package helpful. With it you can make a color wheel or a rectangle containing all shades in a certain region of Hue or RGBColor space. Download the package from http://www.mathsource.com/cgi-bin/msitem?0210-700 I was able to use the package to empirically find approximations for several colors in a Rainbow. They are: Red - Hue[0,1,1] Orange - Hue[1/12,6/10,1] Yellow - Hue[1/6,1,1] Green - Hue[1/3,1/2,1] Blue - Hue[2/3,1,1] Violet - Hue[5/6,1,1] I trust you can find a chart that shows the shades for various wavelengths. You can then correspond several wavelengths with the Hue[h,s,b] settings that produce approximately the same color. Once you have a sufficient number of shades paired up you can perform an interpolation between adjacent colors. You might also find my 'ColorScale' function in the package helpful. It shows all shades along a linear interpolation between any two shades using Hue or RGBColor specification. Notice, Hue[0,1,1] gives the same color as Hue[1,1,1]. To get an interpolation between Violet and Red you should interpolate between Hue[5/6,1,1] and Hue[1,1,1] respectively. -------------------- Regards, Ted Ersek Download Mathematica tips, tricks from http://www.verbeia.com/mathematica/tips/Tricks.html