[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting the color pallete without calling LoadCT first

Ricardo Fonseca wrote:
> Hi
> I need to get the color table from one of the default IDL colortables. Right
> now I'm doing it like this:
>   loadct, ct, NCOLORS = 256
>   TVLCT, rr, gg, bb, /get
> I was wondering I there was a way to do this without actually loading the
> color pallete i.e. without calling loadct
> Thanks in advance, Ricardo

The code for reading in the color tables is in loadct and it basically consists
of (modified slightly):

filename = filepath('colors1.tbl', subdir=['resource', 'colors'])
openr,lun, filename, /get_lun
aa=assoc(lun, bytarr(256),1)    ;Read 256 long ints
r = aa[table_number*3]
g = aa[table_number*3+1]
b = aa[table_number*3+2]

You can obviously parse them all in at once this way if that's what you're


 J.D. Smith                             |*|      WORK: (607) 255-5842    
 Cornell University Dept. of Astronomy  |*|            (607) 255-6263
 304 Space Sciences Bldg.               |*|       FAX: (607) 255-5875 
 Ithaca, NY 14853                       |*|