Coyote Graphics Routines

Date: Fri Mar 27 12:14:20 2015

single page | use frames     summary     class     fields     routine details     file attributes

.\

cgpickcolorname.pro

Graphics, Utilities, Color


Provides an interactive method of selecting a draw color name. The program is useful for learning the color names available in the Coyote Graphics System.

The program requires the Coyote Library to be installed on your machine.

Examples

To call the program from the IDL comamnd line:

IDL> color = cgPickColorName() & Print, color
To call the program from within a widget program:
color = cgPickColorName("red", Group_Leader=event.top) & Print, color

Author information

Author

FANNING SOFTWARE CONSULTING:

David W. Fanning 1645 Sheely Drive Fort Collins, CO 80526 USA Phone: 970-221-0438 E-mail: david@idlcoyote.com Coyote's Guide to IDL Programming: http://www.idlcoyote.com

Copyright

Copyright (c) 2000-2015, Fanning Software Consulting, Inc.

History

Change History:

Written by: David W. Fanning, 31 August 2000. Modified program to read colors from a file and to use more colors on 24-bit platforms. 16 October 2000. DWF. Added the COLUMNS keyword. 16 October 2000. DWF. Fixed a small problem with mapping a modal widget. 2 Jan 2001. DWF Now drawing small box around each color. 13 March 2003. DWF. Added eight new colors. Total now of 104 colors. 11 August 2005. DWF. Modified GUI to display system colors. 13 Dec 2005. DWF. Added BREWER keyword to allow Brewer Colors. 15 May 2008. DWF. Added all BREWER names to the default naming scheme. 3 July 2008. DWF. Set a size for the color name label widget. Otherwise, the widget always jumps back to the center of the display when I select a color on UNIX machines. Also had to remove TLB updating with UPDATE keyword to avoid tickling the same IDL bug. Sigh... 13 March (Friday) 2009. Removed system color names, since these are no longer available in cgColor. 27 Nov 2010. DWF Renamed cgPickColorName. 20 Oct 2012. DWF. Added 12 colors suggested by Paul Krummel for people with color blindness. See the last line in Figure 3 of `this reference <http://www.sron.nl/~pault/>`. 16 Jan 2015. DWF.

Routines

cgPickColorName_Select_Color, event

This event handler responds to users selecting a color patch for display.

cgPickColorName_Buttons, event

This event handler responds to users selecting buttons on the GUI.

result = cgPickColorName( [theName], Brewer=Brewer [, Bottom=integer], Cancel=Cancel, Columns=Columns, Filename=Filename, Group_Leader=Group_Leader, Index=Index, Title=Title)

This function creates the widgets that implements the color name selection widget.

Routine details

top cgPickColorName_Select_Color

cgPickColorName_Select_Color, event

This event handler responds to users selecting a color patch for display.

Parameters

event in required type=struct

The event structure passed to the event handler.

top cgPickColorName_Buttons

cgPickColorName_Buttons, event

This event handler responds to users selecting buttons on the GUI.

Parameters

event in required type=struct

The event structure passed to the event handler.

top cgPickColorName

result = cgPickColorName( [theName], Brewer=Brewer [, Bottom=integer], Cancel=Cancel, Columns=Columns, Filename=Filename, Group_Leader=Group_Leader, Index=Index, Title=Title)

This function creates the widgets that implements the color name selection widget.

Parameters

theName in optional type=string default=white

A string with the name of the initial "display" color. Colors available are these:

Almond Antique White Aquamarine Beige Bisque Black Blue Blue Violet Brown Burlywood Cadet Blue Charcoal Chartreuse Chocolate Coral Cornflower Blue Cornsilk Crimson Cyan Dark Goldenrod Dark Gray Dark Green Dark Khaki Dark Orchid Dark Red Dark Salmon Dark Slate Blue Deep Pink Dodger Blue Firebrick Forest Green Gold Goldenrod Gray Green Green Yellow Honeydew Hot Pink Indian Red Ivory Khaki Lavender Lawn Green Light Coral Light Cyan Light Gray Light Salmon Light Sea Green Light Yellow Lime Green Linen Magenta Maroon Medium Gray Medium Orchid Moccasin Navy Olive Olive Drab Orange Orange Red Orchid Pale Goldenrod Pale Green Papaya Peru Pink Plum Powder Blue Purple Red Rose Rosy Brown Royal Blue Saddle Brown Salmon Sandy Brown Sea Green Seashell Sienna Sky Blue Slate Blue Slate Gray Snow Spring Green Steel Blue Tan Teal Thistle Tomato Turquoise Violet Violet Red Wheat White Yellow
The color WHITE is used if this parameter is absent.

These Brewer Color names are also available:

WT1 WT2 WT3 WT4 WT5 WT6 WT7 WT8 TAN1 TAN2 TAN3 TAN4 TAN5 TAN6 TAN7 TAN8 BLK1 BLK2 BLK3 BLK4 BLK5 BLK6 BLK7 BLK8 GRN1 GRN2 GRN3 GRN4 GRN5 GRN6 GRN7 GRN8 BLU1 BLU2 BLU3 BLU4 BLU5 BLU6 BLU7 BLU8 ORG1 ORG2 ORG3 ORG4 ORG5 ORG6 ORG7 ORG8 RED1 RED2 RED3 RED4 RED5 RED6 RED7 RED8 PUR1 PUR2 PUR3 PUR4 PUR5 PUR6 PUR7 PUR8 PBG1 PBG2 PBG3 PBG4 PBG5 PBG6 PBG7 PBG8 YGB1 YGB2 YGB3 YGB4 YGB5 YGB6 YGB7 YGB8 RYB1 RYB2 RYB3 RYB4 RYB5 RYB6 RYB7 RYB8 TG1 TG2 TG3 TG4 TG5 TG6 TG7 TG8 Here are color names for colors appropriate for color blind users:
CG1 CG2 CG3 CG4 CG5 CG6 CG7 CG8 CG9 CG10 CG11 CG12

Keywords

Brewer
Bottom in optional type=integer

The colors used in the program are loaded in the color table. This keyword indicates the index in which the colors start loading. By default Bottom is set equal to 256-NCOLORS-1. brewer: in, optional Previously used to select Brewer colors. No longer in use, as the Brewer colors are loaded automatically. cancel: out, optional, type=integer On exit, this keyword value is set to 0 if the user selected the ACCEPT button. IF the user selected the CANCEL button, or closed the window in any other way, this keyword value is set to 1. columns: in, optional, type=integer, default=12 Set this keyword to the number of columns to use in the color display. filename: in, optional, type=string The name of an ASCII file that can be opened to read in color values and color names. There should be one color per row in the file. Please be sure there are no blank lines in the file. The format of each row should be:

redValue greenValue blueValue colorName
Color values should be between 0 and 255. Any kind of white-space separation (blank characters, commas, or tabs) are allowed. The color name should be a string, but it should NOT be in quotes. A typical entry into the file would look like this:
255 255 0 Yellow
group_leader: in, optional, type=long This keyword identifies a group leader if the program is called from within a widget program. Note that this keyword *must* be provided if you want to guarantee modal widget functionality. (If you don't know what this means, believe me, you WANT to use this keyword, always.) index: in, optional This keyword identifies a color table index where the selected color is to be loaded when the program exits. The default behavior is to restore the input color table and NOT load a color. title: in, optional, type=string, default="Select a Color" This keyword accepts a string value for the window title.

Cancel
Columns
Filename
Group_Leader
Index
Title

File attributes

Modification date: Fri Mar 27 11:07:38 2015
Lines: 713
Docformat: rst rst