CGDEFAULTCOLOR
The purpose of this function is to choose a default color for Coyote Graphics routines.
Categories
Graphics
Returns
Returns a scalar or vector (depends on the type of the input color) of color
names (strings) to be used as the "color" in Coyote Graphics routines. If the
MODE is 1 and the inputColor is of type LONG, then the return value is an array
or scalar of type LONG.
Params
inputcolour: in, optional
The input color. May be undefined, a byte, integer, long, or string. If the
device is in indexed color mode at the time the request is made, then all,
byte, integer, and long values will be treated as indices into the current
color table. The variable may be a vector.
Keywords
background: in, optional, type=boolean
If this keyword is set, the color is treated as a background color. Otherwise,
it is treated as a drawing color.
default: in, optional
A color of any type allowed as the `inputColour`. Used if the `inputColour` is undefined.
mode: in, optional, type=boolean
The color mode. A 0 mean indexed color mode. A 1 means decomposed color mode.
If not supplied in the call, the color mode is determined at run-time with `GetDecomposedState`.
The color mode is *always* determined at run time if the current graphics device
is the PostScript device.
traditional: in, optional, type=boolean, default=0
Set this keyword if you are using the traditional color scheme of white foreground
and black background. If this keyword is set, and the current graphics device is
the PostScript device, the colors will be reversed, in the traditional IDL graphics
way.
Examples
Use as a device independent way to get a color::
background = cgDefaultColor(bColor, /Background)
color = cgDefaultColor(bColor)
cgPlot, cgDemoData, Background=background, Color=color
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
History
Change History::
Written, 24 December 2011. David W. Fanning.
Modified to make sure a LONG integer in indexed color mode is in the range 0-255. 10 Jan 2012. DWF.
Modified to make sure MODE is always determined at run-time for PostScript device. 14 Jan 2012. DWF.
Allow other data types to be treated as color table index numbers, as long as they are in the
range 0 to 255, and the MODE indicates indexed color. 7 March 2012. DWF.
Modified so that the variable MODE will not change in the calling program program. 8 March 2012. DWF.
Made FOR loop counter a LONG integer. 3 July 2012. DWF.
More work on getting the MODE correct to handle LONG integers properly. Now, in PostScript, we get
the current mode, except if we have been told what mode to be in. 21 July 2012. DWF.
Copyright
Copyright (c) 2011, Fanning Software Consulting, Inc.