RE: Color names and the 10 elementary colors?
- To: mathgroup at smc.vnet.net
- Subject: [mg67598] RE: [mg67528] Color names and the 10 elementary colors?
- From: "David Park" <djmp at earthlink.net>
- Date: Sat, 1 Jul 2006 05:13:01 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
First, if you use DrawGraphics, the DrawGraphics palette has all the named colors on it - displayed as colors. The colors are grouped roughly in six color bands so all the greenish colors, for example, are grouped together. When you click on a color it pastes the color name in your notebook. They are not converted to RGBColor until they are evaluated. It was in Version 5.1 that WRI moved some of the named colors to the kernel from the Graphics`Colors` package. I suppose the reason was that users wouldn't have to load a package to get the most common color names. Nevertheless, I think this was a serious mistake because it broke the uniform treatment of the named colors. If you check the MathGroup postings back then you will see that I complained vociferously about it. The uniformity of the named colors was also broken in another more serious way. The neutral colors, Black, White and Gray were changed from an RGBColor representation to a GrayLevel representation. This not only broke user code, but even broke WRI's own code. For example, the Raster function, which underlies DensityPlots, requires that all the colors have the same representation. So, as an example, the following code gives errors and incorrect colors. Needs["Graphics`Colors`"] myArray = N[Table[Sin[x y], {x, 1, 40}, {y, 1, 40}]]; colorfun[z_] := Which[ z < -0.75, Gray, z < -0.5, LightCoral, z < 0.0, PaleGreen, z < 0.5, CadetBlue, z < 0.8, GeraniumLake, True, UltramarineViolet ] ListDensityPlot[myArray, Mesh -> False, ColorFunction -> colorfun, ColorFunctionScaling -> False]; (There is also another error if you try to convert the above plot to Graphics format. This produces a Raster array as a primitive, but they forgot to copy the ColorFunctionScaling option into the Raster statement. It is a proper and necessary option for Raster as is ColorFunction, which they do copy in.) There is another slight error, in my view, in the named colors in that SeaGreen and DarkSeaGreen seem to be reversed. DarkSeaGreen appears to my eyes to be lighter than SeaGreen. When I asked what reason WRI had for breaking the uniform treatment of the named colors they replied 'efficiency'. However, it is certainly not more efficient if one has to check for and handle special cases. I would still like to see the treatment for the named colors restored to the pre Version 5.1 state. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: AES [mailto:siegman at stanford.edu] To: mathgroup at smc.vnet.net When I recently inquired about using the names of Mathematica colors ("CinnabarGreen", etc.) as label strings in a series of test plots, several responses proposed that I needed to manually input the names in quotes. Brian Higgins suggested, however, a terse but somewhat arcane way to get color names as strings together with the corresponding RGB values with the Input line allColorNames = ({#1, ToColor[ ToExpression[#1], RGBColor]}&) /@ AllColors; so that the Input allColorNames[[4]] produces the Output { Apricot, RGBColor[1., 0.340007, 0.129994] } (although his Output showed quotes around "Apricot" and mine doesn't.) Since my objective was to test all varieties of Green, I added to this a more crudely programmed statement to generate a list of all the green color names and color values, viz. allGreens={ }; Do[ If[ StringMatchQ[ allColorNames[[k,1]], "*Green*" ], AppendTo[ allGreens, allColorNames[[k]] ] ], {k, 1, Length[ allColorNames ]} ]; This works fine -- until you notice that just plain "Green" itself is not in the resulting list. In fact, Green (along with Red, Blue, Brown, Orange, and 4 or 5 other "elementary colors") is not in AllColors. I believe in earlier versions of Mathematica one had to use Graphics`Colors` to access even these elementary colors, and so they were presumably once included in AllColors (?); and I think I've learned somewhere that 10 or so of these elementary colors are now included within "plain Mathematica" and no long require calling the Graphics`Colors` package. But: 1) I'd sure like to understand the logic of not continuing to use these colors in AllColors nonetheless. Removing them seems a confusing and less than helpful choice to me at any rate. And, 2) Where -- or more important, how -- can the nonexpert user get at the list of these elementary colors? As a challenge, try invoking online Help on "Color" or "Colors" or any one of the elementary color names, and see if, using no more than 5 subsequent mouse clicks within the Help screen, no typing, and no pre-existing expert knowledge, just "common sense", you can find your way to the list of those colors.