MathGroup Archive 2000

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

Search the Archive

Re: physical colors and Mathematica colors

> 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?
> I understand that human color perception is a complicated matter, and so
> rendering of color on computer display devices.  (The brightness dimension
> is perhaps the most obvious ambiguity.)  It's probably nonsense  to ask
> a "perfect" correspondence between wavelength and RGB.  But is there a
> "standard" mapping?  Or one that you think is "pretty good"?


I don't think that will be much help to you. I hope at least a bit.
Anyway, I guess linear mapping from wavelength to hue percentage domain is a
good first order approximation.

hueValue[lambda_] := Fit[{{380, 0.8}, {750, 0}}, {1, lambda}, lambda]

Where 380nm corresponds to violet and 750nm to red, and correspondig hue
values are 0.8 and 0.

I don't know if binaries are permitted in this newsgroup (if not, they
should be!), but I even made an image collaged from 'true' (above) specter
and Mathematica Hue (below) linear specter.  [no binaries - contact the
author to get this - moderator]

Usage of Hue[h] is equivalent to Hue[h,1,1] where saturation and brightness
are taken to be 1, i.e. 100%.

Well, bye

Borut Levart
a physics student

  • Prev by Date: Re: Pattern match exactly 0 or 1 times?
  • Next by Date: Re: physical colors and Mathematica colors
  • Previous by thread: Re: physical colors and Mathematica colors
  • Next by thread: Re: physical colors and Mathematica colors