source: trunk/SRC/Colors/lct.pro @ 378

Last change on this file since 378 was 327, checked in by pinsard, 17 years ago

modification of headers : mainly blanks around = sign for keywords in declaration of function and pro

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.7 KB
Line 
1;+
2;
3; @file_comments
4; Fastest than type loadct, file = 'palette.tbl'
5;
6; @categories
7; Graphics, Color
8;
9; @param numpal {in}{optional}
10; number of the color palette we want to select in the file palette.tbl
11;
12; @keyword LIGHTNESS
13; a scalar used to change the Lightness of the color
14; palette to be able to adjust according to the printer we use,
15; the media (paper or slide)...
16;               lightness < 1 to get lighter colors
17;                         > 1 to get darker colors
18;
19; @keyword FILE {default='palette.tbl'}
20; The file containing the color palette. It can be in any directory of the !path
21;
22; @keyword GET_NAME
23; Set this keyword to a named variable in which the names of the color tables
24; are returned as a string array. No changes are made to the color table.
25;
26; @keyword _EXTRA
27; Used to pass keywords to <proidl>LOADCT</proidl>
28;
29; @history
30; Sebastien Masson (smasson\@lodyc.jussieu.fr)
31; 30/3/1999: add extra
32; 6/7/1999: mac/windows compatibility
33;
34; @version
35; $Id$
36;
37;-
38PRO lct, numpal, FILE=file, GET_NAME=get_name, LIGHTNESS=lightness, _EXTRA=ex
39;
40  compile_opt idl2, strictarrsubs
41;
42; definition of the name of the file containing colors palettes.
43  if keyword_set(file) then nametbl = file ELSE nametbl = 'palette.tbl'
44; look for nametbl file
45  nametbl = find(nametbl, /firstfound, /nopro)
46  if nametbl NE 'NOT FOUND' then BEGIN
47    if n_elements(ex) NE 0 then $
48       if (where(tag_names(ex) EQ 'FILE'))[0] NE -1 then ex.FILE = nametbl
49; if we are in POSTSCRIPT mode, we have to pass in X mode in order to change the color palette
50    oldname = !d.name
51    if !d.name EQ 'PS' OR !d.name EQ 'Z' then BEGIN
52      thisOS = !VERSION.OS_FAMILY
53      thisOS = STRMID(thisOS, 0, 3)
54      thisOS = STRUPCASE(thisOS)
55      CASE thisOS of
56        'MAC': SET_PLOT, thisOS
57        'WIN': SET_PLOT, thisOS
58        ELSE: SET_PLOT, 'X'
59      ENDCASE
60      !p.BACKGROUND = (!d.n_colors-1) < 255
61      !p.color = 0
62      if !d.n_colors gt 256 then !p.background = 'ffffff'x
63    ENDIF
64;
65    if arg_present(get_name) then begin
66      if n_elements(numpal) EQ 0 then $
67         loadct, file = nametbl, GET_NAME = get_name, _EXTRA = ex $
68      ELSE loadct, numpal, file = nametbl, /silent, GET_NAME = get_name, _EXTRA = ex
69    ENDIF ELSE BEGIN
70      if n_elements(numpal) EQ 0 then loadct, file = nametbl, _EXTRA = ex $
71      ELSE loadct, numpal, file = nametbl, /silent, _EXTRA = ex
72    ENDELSE
73;
74    if oldname EQ 'PS' AND keyword_set(lightness) then palit, lightness
75;
76    set_plot, oldname
77    IF oldname EQ 'X' OR oldname EQ 'MAC' OR oldname EQ 'WIN' then BEGIN
78      !p.BACKGROUND = (!d.n_colors-1) < 255
79      !p.color = 0
80      if !d.n_colors gt 256 then !p.background = 'ffffff'x
81    ENDIF
82
83  ENDIF ELSE ras = report('The file containing the color palettes doesn''t exist...')
84
85  return
86end
Note: See TracBrowser for help on using the repository browser.