## NAME

d.colors - Allows the user to interactively change the color table of a raster map layer displayed on the graphics monitor.
(GRASS Display Program)

## SYNOPSIS

d.colors
d.colors help
d.colors map=name

## DESCRIPTION

A color table file associates specific colors with the categories of a raster map layer. The user can change these map category color assignments (i.e., change the map's color table) interactively, by first displaying the raster map to the graphics monitor and then running the program d.colors. If you have first set d.colormode to "float" before displaying the map to the graphics monitor, any color changes that you subsequently make while in d.colors will immediately (and interactively) appear on the graphics display.

While running d.colors
the cursor must be inside the window where the execution takes place. When in "float" colormode, the correct colors appear on the graphics monitor only if the cursor is inside the monitor. To see the correct colors, move the cursor from the execution window to inside the graphics monitor, then move back to the window to continue making changes.

If d.colormode is "fixed", any color changes made using d.colors will not immediately be shown on the graphics display; however, any color changes saved will still alter the map's color table and will appear next time the raster map layer is redisplayed (see d.colormode and d.colortable). Note that some graphics display monitors or drivers cannot support interactive color change.

The user must first display the relevant raster map layer to the active frame on the graphics monitor (e.g., using d.rast or d.display) before running d.colors. The user can then either enter the name of the raster map layer whose color table is to be changed on the command line (e.g., by typing: d.colors map=soils), or type d.colors without program arguments. If the user simply types d.colors without program arguments on the command line, d.colors will ask the user to enter the name of an existing raster map layer using the standard GRASS interface described in the manual entry for parser.

In either case, the user is then presented with the d.colors command menu, shown below. This menu is the same as the category and color changing portion of the d.display menu. The d.colors commands are listed beneath the Category Pointer Movement, Color Modification, Replotting Screen, and Quitting sections below. Commands are invoked by typing in the single-key response shown to the left below. (Longer descriptions of these commands appear to the right.) Results from invoking these commands will be reflected in the Category and Category Number sections of the d.colors screen. On the d.colors screen menu, commands appear in the right half of the screen, and the current status of categories appears in the left half of the screen.

    CATEGORIES
       0    No Data
       1    (Category 1 description)
       2    (Category 2 description)
       .    ....
       .    ....
    CATEGORY NUMBER:
       RED         0   0%
       GREEN       0   0%
       BLUE        0   0%
    Shift Incr:   10   3%
    CATEGORY POINTER MOVEMENT
       D/d  down (cats)        Move pointer to next category
       U/u  up   (cats)        Move pointer to previous category
    COLOR MODIFICATIONS
       R/r  RED                Increase/decrease RED intensity
       G/g  GREEN              Increase/decrease GREEN intensity
       B/b  BLUE               Increase/decrease BLUE intensity
       I/i  increment          Increase/decrease increment
                               (of intensity shift)
       h    highlight          Highlight current color
       +/-  shift colors       Shift entire color table (up/down)
       c    save color         Save color table
       t    toggle table       Toggle to different color table
    REPLOTTING SCREEN
       *    Replot screen      Replots the screen
    QUITTING
       Q    quit               Quits program

Changing categories - The keys "d, D, u," and "U" are used to move to a different category. The lower case letters move up, u, and down, d, the category list one category at a time. The upper case letters move 10 categories at a time for fast movement. The cursor does wrap between the first and last categories. The current category is noted on the text screen with an arrow, and is indicated on the graphics screen by a box around the current color.

Changing colors - The color associated with the current category can be changed with the "R, r, G, g, B," and b keys. The upper case letters increase the intensities of red R, green G, and blue B for the current category; the lower case letters decrease the intensities of these same colors for the current category. Video devices make all the colors of the spectrum by mixing red, green, and blue. For those accustomed to red, yellow, and blue being the primary colors, this can be confusing. For starters, yellow is made by mixing red and green. The intensities are listed on the text screen in as percentages.

Keys I and i increase and decrease the percentage change that each keystroke of one of the color keys (R, r, G, g, B, b) causes in its respective color. The increase increment is initially set to 10%. Thus, pressing the R key would will increase the red component of the current category by 10%.

Highlight - The h key toggles between the current category color and the current highlight color. This color is initially black but can be modified as above while in highlight mode. Blinking can be accomplished by repeatedly striking the h key. When changing to different categories using the movement keys as described above, while in highlight mode the category colors will be always left showing their actual colors. Only one category is highlighted at any one time.

Saving the current color table - Pressing the c key will save the current color table as you have modified it. This table will then be used next time you display or paint this raster map layer.

Color table toggle - Different types of color tables are suitable for different raster map layers. The key t flips between the following color tables: red, green, blue color ramp; gray scale; smooth changing color wave; random colors; and the saved color table.

Color table shift - The entire table is shifted up and down using the + and - keys.

Quitting the d.colors program - Pressing the Q key will cause you to quit the d.colors program. If colors have been modified but not saved, d.colors will ask:

             Colors changed
             Save the changes? (y/n)

The user should type in y to save changes, or n to not save changes, before quitting the program. If the user types n, the program will ask:

             Quit anyway? (y/n)

## NOTES

To see map color changes reflected on the display monitor as you make them, you must put the monitor in float color mode before running d.colors. It is also wise to erase the display screen after changing the color mode.

The map whose color table is to be altered with d.colors must already be on display in the active display frame on the graphics monitor before d.colors is run. This can be done using the command d.rast map=name (where name is a raster map layer whose color table the user wishes to alter).

The user might type the following sequence of commands to interactively change the colors of a raster soils map:

  d.colormode mode=float
  d.erase
  d.rast map=soils
  d.colors

After the user has saved any color changes made with d.colors and exited the program, the user could then redisplay the soils map with the new colors by typing:

  d.colormode mode=fixed
  d.erase
  d.rast map=soils

Some color monitors may not support the full range of colors required to display all of the map's categories listed in the map's color table. However, regardless of whether the user can see the color changes he is effecting to a map's color table, any changes to a map's color table made with d.colors that are saved will appear in the map's color table.

Some monitors may not support an interactive color change capability.

## SEE ALSO

d.colormode
d.colortable
d.display
d.rast
p.colors
r.colors
parser

## AUTHOR

James Westervelt, U.S. Army Construction Engineering Research Laboratory

Last changed: $Date: 2003/08/20 08:10:12 $