MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re:physical colors and Mathematica colors

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

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.

Ted Ersek

Download Mathematica tips, tricks from

  • Prev by Date: Re: Question: numerical solution of nonlinear differential equation
  • Next by Date: Re: ListPlot bug
  • Previous by thread: Re: physical colors and Mathematica colors
  • Next by thread: Re: physical colors and Mathematica colors