|
IDL Reference Guide: Procedures and Functions |
|
The LOADCT procedure loads one of 41 predefined IDL color tables. These color tables are defined in the file colors1.tbl, located in the \resource\colors subdirectory of the main IDL directory, unless the FILE keyword is specified. The selected colortable is loaded into the COLORS common block as both the "current" and "original" colortable. If the current device has fewer than 256 colors, the color table data is interpolated to cover the number of colors in the device.
This routine is written in the IDL language. Its source code can be found in the file loadct.pro in the lib subdirectory of the IDL distribution.
All of the IDL color-table procedures maintain the current color table in a common block called COLORS, defined as follows:
COMMON COLORS, R_orig, G_orig, B_orig, R_curr, G_curr, B_curr
The variables are integer vectors of length equal to the number of color indices. Your program can access these variables by defining the common block. The convention is that routines that modify the current color table should read it from R_orig, G_orig, and B_orig, then load the color table using TVLCT and leave the resulting color table in R_curr, G_curr, and B_curr.
LOADCT [, Table] [, BOTTOM=value] [, FILE=string] [, GET_NAMES=variable] [, NCOLORS=value] [, RGB_TABLE=value] [, /SILENT]
The number of the pre-defined color table to load, from 0 to 40. If this value is omitted, a menu of the available tables is printed and the user is prompted to enter a table number.
The first color index to use. LOADCT will use color indices from BOTTOM to BOTTOM+NCOLORS-1. The default is BOTTOM=0.
Set this keyword to the name of a colortable file to be used instead of the file colors1.tbl. See MODIFYCT to create and modify colortable files.
Set this keyword to a named variable in which the names of the color tables are returned as a string array. No changes are made to the color table.
The number of colors to use. The default is all available colors (this number is stored in the system variable !D.TABLE_SIZE).
Set this keyword to a named variable in which to return the desired color table as an [NCOLORS, 3] array. If this keyword is set, then the color table is not loaded into the display, but is simply returned to the user. In addition, if RGB_TABLE is set then SILENT is also set to true.
If this keyword is set, the Color Table message is suppressed.
The following example introduces using LOADCT.
| Tip If you are running IDL on a TrueColor display, set DEVICE, DECOMPOSED = 0 before your first color table related routine is used within an IDL session or program. |
LOADCT
The list of color tables appears in the Output Log:
When running LOADCT without an argument, it will prompt you to enter the number of one of the color tables at the IDL command line.
Enter table number: prompt:Enter table number: 5
The following text is displayed in the Output Log:
% LOADCT: Loading table STD GAMMA-II
If you already know the number of the pre-defined color table you want, you can load a color table by providing that number as the first input argument to LOADCT.
LOADCT, 13
The following text is displayed in the Output Log:
% LOADCT: Loading table RAINBOW
TV, DIST(300)
| Note To see the organization of the colors associated with each color table, use XLOADCT . |
IDL Online Help (March 06, 2007)