>  Docs Center  >  Libraries  >  Coyote  >  PICKCOLOR

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: davidf@dfanning.com
      Coyote's Guide to IDL Programming: http://www.dfanning.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



      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.
      Changed FSC_Color to cgColor everywhere. 16 Jan 2013. DWF.



© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us