MathGroup Archive 1999

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

Search the Archive

RE: RGB color cube & HLS color cone

  • To: mathgroup at
  • Subject: [mg19747] RE: [mg19706] RGB color cube & HLS color cone
  • From: "Ersek, Ted R" <ErsekTR at>
  • Date: Wed, 15 Sep 1999 03:53:01 -0400
  • Sender: owner-wri-mathgroup at

Dick Phillips wrote:
Has anyone developed code to display a 3D RGB color cube and/or a 3D HLS
color cone? I'd like to be able to rotate, slice, etc. such objects.

I am working on a package that does much of this.  The package includes four
functions ColorWheel, ColorPlot, ColorScale, GetColor.

ColorWheel[]  makes a wheel of colors with the specification
Hue[h,s,1].  The colors approach white in the center.

ColorWheel[CenterColor->"Black"]  makes a wheel of colors where the colors
approach black in the center.

The lines below make a Graphic of the colors in the range specified.  You
can use ColorPlot to zoom in on a small range of colors.  ColorPlot has a
PlotPoints option, and the graphic looks like a continuum if PlotPoints->60
is used.  You can click on the graphic and use the mouse to get precise
(r,g,b) or (h,s,b) values of any color displayed.








ColorScale shows all the shades along a "straight line" between one color
and another.  It works with Hue and RGBColor as in:

gr1=ColorScale[RGBColor[0.7,0.8,0.25], RGBColor[0.85,0.77,0.35]];


The strip of colors shown by ColorScale includes a horizontal axis with tick
marks (the colors start at 0 and stop at 1).  GetColor takes two arguments.
The first argument must be the graphic returned by ColorScale, and the
second argument must be a number between 0 and 1.  Using the line below
GetColor returns the color at 0.2 on the graphic ColorScale displays. 

  GetColor[gr2, 0.2]

I will email it to you later this week after I do a little more work on it
I.  If anyone else wants it let me know.  Eventually I will send it to

Ted Ersek

For Mathematica tips, tricks see

  • Prev by Date: Re: 3D Projection
  • Next by Date: Some problems with DSolve and NDSolve
  • Previous by thread: RGB color cube & HLS color cone
  • Next by thread: Re: RGB color cube & HLS color cone