>  Docs Center  >  Libraries  >  Motley  >  MGH_COLOR
Libraries

MGH_COLOR

MGH_COLOR

Name


  MGH_COLOR

Purpose


  This function accepts one or more colour specifiers in string form
  and returns an array containing corresponding RGB colour values.
  The colour data are specified in a file, mgh_color.dat, which
  must be in the same directory as the source file.

Category


  Graphics, Color Specification.

Calling Sequence


  result = MGH_COLOR(name)

Positional Parameters


  name (input, string)
    Colour specifier. Each elements may be in one of two forms:
      - If the string begins with "(" and ends with ")" then the
        characters between are assumed to contain an RGB-coded
        colour value in numeric form, eg. "(255,0,255)" or "(255 0
        255)". The conversion is done using a READS statement and if
        an IO error occurs the corresponding value in the output is
        left at 0.
      - Otherwise the specifier is matched against a list of
        pre-defined colour names. If no match is found then black
        [0,0,0] is returned.

Keyword Parameters


  DECOMPOSED (input, switch)
    Set this keyword to return a scalar or n-element long-word
    vector in which RGB values are stored in the least-significant
    three bytes. (This is the form required by direct-graphics
    devices when the DECOMPOSED keyword is set.) The default is to
    return a [3] or [3,n] byte array, as required by the Object
    Graphics system.
  NAMES (input, switch)
    Set this keyword to return a list of the colour names recognised
    by the function. The "name" argument is then ignored.
  REREAD (input, switch)
    Set this keyword to cause the colour-data file to be
    reread. Normally it is only read the first time the function is
    run. This keyword is useful when testing changes to the
    colour-data file.
###########################################################################
  This software is provided subject to the following conditions:
  1. NIWA makes no representations or warranties regarding the
    accuracy of the software, the use to which the software may
    be put or the results to be obtained from the use of the
    software. Accordingly NIWA accepts no liability for any loss
    or damage (whether direct of indirect) incurred by any person
    through the use of or reliance on the software.
  2. NIWA is to be acknowledged as the original author of the
    software where the software is used or presented in any form.
###########################################################################

Modification History


  Mark Hadfield, 1998-03:
    Written, inspired by David Fanning's GETCOLOR.
  Mark Hadfield, 2000-07:
    Updated for IDL2 syntax
  Mark Hadfield, 2001-10:
    - Added DECOMPOSED keyword.
    - Colour names & associated values are now read from a file.
  Mark Hadfield, 2001-11:
    Added support for numeric specifiers.
  Mark Hadfield, 2004-03:
    Now uses David Fanning's PROGRAMROOTDIR function to find the data
    file.
  Mark Hadfield, 2007-11:
    Sometime in the last few years, this function has stopped using
    PROGRAMROOTDIR.



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