Re: Re: Color names and the 10 elementary colors?
- To: mathgroup at smc.vnet.net
- Subject: [mg69431] Re: [mg67575] Re: [mg67528] Color names and the 10 elementary colors?
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Tue, 12 Sep 2006 06:53:01 -0400 (EDT)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <200607010912.FAA20399@smc.vnet.net>
- Reply-to: murray at math.umass.edu
In Mathematica 5.2, how does one find all the names of BUILT-IN colors
-- as opposed to those given names only in Graphics`Colors`?
Bob Hanlon wrote:
> Needs["Graphics`"];
>
> All Colors and GrayLevels:
>
> mc = DeleteCases[Select[Names[],
> (Head[ToExpression[#]] == RGBColor ||
> Head[ToExpression[#]] == GrayLevel) &],
> _?(# == "System`Convert`MathMLDump`$defaultColor" ||
> # == "se" &)];
>
> Colors and GrayLevels not in AllColors:
>
> Complement[mc,AllColors]
>
> {AquamarineMedium,Black,Blue,BlueLight,BlueMedium,Brown,Cadet,CadmiumRedDeep,\
> CadmiumRedLight,CadmiumYellowLight,CobaltVioletDeep,CoralLight,Cyan,\
> GoldenrodDark,GoldenrodLight,GoldenrodPale,Gray,Green,GreenDark,GreenPale,\
> KhakiDark,MadderLakeDeep,Magenta,NaplesYellowDeep,OliveGreenDark,Orange,\
> OrchidDark,OrchidMedium,Pink,PinkLight,Purple,PurpleMedium,Red,SeaGreenDark,\
> SeaGreenLight,SeaGreenMedium,SkyBlueDeep,SkyBlueLight,SlateBlueDark,\
> SlateBlueLight,SlateBlueMedium,SlateGrayDark,SlateGrayLight,SpringGreenMedium,\
> SteelBlueLight,TurquoiseDark,TurquoiseMedium,TurquoisePale,VioletDark,\
> VioletRedMedium,VioletRedPale,ViridianLight,White,Yellow,YellowLight}
>
> Names["*Green*"]
>
> {ChromeOxideGreen,CinnabarGreen,CobaltGreen,DarkGreen,DarkOliveGreen,\
> DarkSeaGreen,EmeraldGreen,ForestGreen,Green,GreenDark,GreenishUmber,GreenPale,\
> GreenYellow,LawnGreen,LightSeaGreen,LimeGreen,MediumSeaGreen,\
> MediumSpringGreen,OliveGreenDark,PaleGreen,PermanentGreen,SapGreen,SeaGreen,\
> SeaGreenDark,SeaGreenLight,SeaGreenMedium,SpringGreen,SpringGreenMedium,\
> YellowGreen}
>
> If you convert this to InputForm the string quotes will be visible.
>
>
> Bob Hanlon
>
> ---- AES <siegman at stanford.edu> wrote:
>> 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.
>>
>
>
--
Murray Eisenberg murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305