>  Docs Center  >  Libraries  >  Buie  >  CPALETTE
Libraries

CPALETTE

CPALETTE

Name


  cpalette

Purpose (one Line Only)


  Choose a color from a selection of palettes

Description



  This routine will look up a color out of a palette. You give the name
    of the palette. A file named color.<set>.dat is expected to be
    somewhere in your path. These files contain RGB triplets. The input
    index must be in the file. If there are any errors, a color of '7f7f7f'xl
    is returned.
  The file format needed is an ASCII tabular file that can be read by readcol.
    Each line must contain a set of three values, R G B, as integers (will
    be read in and used as byte data). You are allowed to have comments
    in the file. Text after the three values will be ignored. You can have
    as many or as few colors in the table as you like but practically you
    should have at least 2 and no more than 256. More colors than 256
    are allowed but will be less useful in some contexts. The index for
    each color in the file counts up from 0 being the index of the first
    triplet.

Category


  Miscellaneous

Calling Sequence


  color=palette(index,set)

Inputs


  index - index number of the color in the set to return

Optional Input Parameters


  set - string, name of the set of colors to pull from, the default is
          the last set loaded and if none are loaded the crayola set is used.

Keyword Input Parameters


  ARRAY - Flag, if set forces the output to be in a three-element array

Outputs


Keyword Output Parameters


Common Blocks


  mwb_palette_com
    contains the last palette that was read in. This is to allow multiple
    calls within the same palette avoid repeated reading of the file.

Side Effects


Restrictions


Procedure


Modification History


  2016/01/10, Written by Marc W. Buie, Southwest Research Institute
  2016/01/18, MWB, added ARRAY keyword



© 2024 NV5 Geospatial Solutions, Inc. |  Legal
   Contact Us