>  Docs Center  >  Libraries  >  Coyote  >  PICKCOLOR
Libraries

PICKCOLOR

PICKCOLOR

Name


      PICKCOLOR

Purpose



      A modal dialog widget allowing the user to select
      the RGB color triple specifying a color. The return
      value of the function is the color triple specifying the
      color or the "name" of the color if the NAME keyword is set.

Author


      FANNING SOFTWARE CONSULTING:
      David Fanning, Ph.D.
      1645 Sheely Drive
      Fort Collins, CO 80526 USA
      Phone: 970-221-0438
      E-mail: david@idlcoyote.com
      Coyote's Guide to IDL Programming: http://www.idlcoyote.com

Category



      Graphics, Color Specification. See related program cgColor.

Calling Sequence



      color = PickColor(colorindex)

Return Value



      The return value of the function is a 1-by-3 array containing
      the values of the color triple that specifies the selected color.
      The color can be loaded, for example, in any color index:
          color = PickColor(240)
          TVLCT, color, 240
      The return value is the original color triple if the user
      selects the CANCEL button.
      IF the NAMES keyword is set, the return value of the function is
      the "name" of the selected color. This would be appropriate for
      passing to the cgColor program, for example.
  OPTIONAL INPUT POSITIONAL PARAMETERS:
      COLORINDEX: The color index of the color to be changed. If not
              specified the color index !D.Table_Size - 2 is used.
              The Current Color and the Color Sliders are set to the
              values of the color at this color index.

Optional Input Keyword Parameters



      BREWER: Set this keyword if you wish to use the Brewer Colors, as defined
              in this reference:
              http://www.personal.psu.edu/cab38/ColorBrewer/ColorBrewer_intro.html
      GROUP_LEADER: The group leader for this widget program. This
              keyword is required for MODAL operation. If not supplied
              the program is a BLOCKING widget. Be adviced, however, that
              the program will NOT work if called from a blocking widget
              program, unless a GROUP_LEADER is supplied.
      NAMES: Set this keyword to return the "name" of the selected color
              rather than its color triple.
      STARTINDEX: 88 pre-determined colors are loaded The STARTINDEX
              is the index in the color table where these 88 colors will
              be loaded. By default, it is !D.Table_Size - 89.
      TITLE: The title on the program's top-level base. By default the
              title is "Pick a Color".

Optional Input Keyword Parameters



      CANCEL: A keyword that is set to 1 if the CANCEL button is selected
              and to 0 otherwise.

Common Blocks



      None.

Side Effects



      88 pre-determined colors are loaded in the color table.
      In addition, the color index at COLORINDEX is modified while
      the program is on the display. When the program exits, the
      entry color table is restored. Thus, on 8-bit displays there
      might be some color effects in graphics windows while PICKCOLOR
      is on the display. Changes in the color table are not noticable
      on 16-bit and 24-bit displays.

Example



      To specify a color for a plot in color decomposition OFF mode:
          Device, Decomposed=0
          !P.Color = !P.Color < (!D.Table_Size - 1)
          color = PickColor(!P.Color, Cancel=cancelled)
          IF NOT cancelled THEN BEGIN
              TVLCT, color, !P.Color
              Plot, data
          ENDIF
      To specify a color for a plot in color decomposition ON mode:
          Device, Decomposed=1
          color = PickColor(Cancel=cancelled)
          !P.Color = Color24(color)
          IF NOT cancelled THEN Plot, data
        To obtain the name of the selected color to pass to GetColor:
          selectedColor = PickColor(/Name)
          axisColor = cgColor(selectedColor, !D.Table_Size-4)

Modification History


      Written by: David Fanning, 28 Oct 99.
      Added NAME keyword. 18 March 2000, DWF.
      Fixed a small bug when choosing a colorindex less than !D.Table_Size-17. 20 April 2000. DWF.
      Added actual color names to label when NAMES keyword selected. 12 May 2000. DWF.
      Modified to use 88 colors and cgColor instead of 16 colors and GETCOLOR. 4 Dec 2000. DWF.
      Now drawing small box around each color. 13 March 2003. DWF.
      Added CURRENTCOLOR keyword. 3 July 2003. DWF.
      Added BREWER keyword. 15 May 2008. DWF.
      Fixed a couple of problems with outline color. 19 May 2008. DWF.
      Added all the colors available from cgColor. 28 Nov 2010. DWF.



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