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