Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

RE: RGB color cube & HLS color cone

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

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.

---------------------
REPLY:
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.

ColorPlot[RGBColor[r,g,0.7],{r,0.7,1},{g,0,6,0.8}]

ColorPlot[RGBColor[r,0.7,b],{r,0.7,1},{b,0,6,0.8}]

ColorPlot[RGBColor[0.7,g,b],{g,0.7,1},{b,0,6,0.8}]

ColorPlot[Hue[h,s,0.7],{h,0.7,1},{s,0,6,0.8}]

ColorPlot[Hue[h,0.7,b],{h,0.7,1},{b,0,6,0.8}]

ColorPlot[Hue[0.7,s,b],{s,0.7,1},{b,0,6,0.8}]

--------------------

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]];

gr2=ColorScale[Hue[0.45,0.25,0.9],Hue[0.55,0.2,1]];

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. 


In[12]:=
  GetColor[gr2, 0.2]
Out[1]=
  Hue[0.47,0.24,0.92]


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
MathSource.

--------------------
Regards,
Ted Ersek

For Mathematica tips, tricks see 
http://www.dot.net.au/~elisha/ersek/Tricks.html



  • 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