.TH r.colors .SH NAME \fIr.colors\fR \- Creates/Modifies the color table associated with a raster map layer. .br \fI(GRASS Raster Program)\fR .SH SYNOPSIS .B r.colors .br \fBr.colors help\fR .br \fBr.colors \fR[\fB-wq\fR] \fBmap\*=\fIname \fBcolor\*=\fItype\fR .SH DESCRIPTION .I r.colors allows the user to create and/or modify the color table for a raster map layer. The map layer (specified on the command line by map\*=\fIname\fR) must exist in the user's current mapset search path. The color table specified by color\*=\fItype\fR must be one of the following: .sp 2 .TS tab(;); l l. color type;description = aspect;(aspect oriented grey colors) grey;(grey scale) grey.eq;(histogram-equalized grey scale) gyr;(green through yellow to red colors) rainbow;(rainbow color table) ramp;(color ramp) random;(random color table) ryg;(red through yellow to green colors) wave;(color wave) rules;(create new color table based on user-specified rules) _ .TE If the user specifies the -w flag, the current color table file for the input map will not be overwritten. This means that the color table is created only if the .I map does not already have a color table. If this option is not specified, the color table will be created if one does not exist, or modified if it does. If the user sets the -q flag, \fIr.colors\fR will run quietly, Without printing numerous messages on its progress to standard output. Color table types \fIaspect, grey, grey.eq\fR (histogram-equalized grey scale), \fIgyr\fR (green-yellow-red), \fIrainbow, ramp, ryg\fR (red-yellow-green), \fIrandom\fR, and \fIwave\fR are pre-defined color tables that \fIr.colors\fR knows how to create without any further input. The \fIrules\fR color table type will cause \fIr.colors\fR to read color table specifications from standard input (stdin) and will build the color table accordingly. Using color table type \fIrules\fR, there are three ways to build a color table: by color list, by category values, and by "percent" values. Building a customized color table by color list is the simplest of the three rules methods: just list the colors you wish to appear in the color table in the order that you wish them to appear. Use the standard GRASS color names: white, black, red, green, blue, yellow, magenta, cyan, aqua, grey, gray, orange, brown, purple, violet, and indigo. For example, to create a color table for the raster map layer \fIelevation\fR that assigns greens to low map category values, browns to the next larger map category values, and yellows to the still larger map category values, one would type: .in +.3i \fBr.colors map\*=elevation color\*=rules .br green .br brown .br yellow .br end\fR .in -.3i To build a color table by category values' indices, the user should determine the range of category values in the raster map layer with which the color table will be used. Specific category values will then be associated with specific colors. Note that a color does not have to be assigned for every valid category value because \fIr.colors\fR will interpolate a color ramp to fill in where color specification rules have been left out. The format of such a specification is as follows: .in +.3i category_value color_name .br category_value color_name .br .. .. .br .. .. .br category_value color_name .br end .in -.3i Each category value must be valid for the raster map layer, category values must be in ascending order and only use standard GRASS color names (see above). Colors can also be specified by color numbers each in the range 0-255. The format of a category value color table specification using color numbers instead of color names is as follows: .in +.3i category_value red_number green_number blue_number .br category_value red_number green_number blue_number .br .. .. .. .. .br .. .. .. .. .br category_value red_number green_number blue_number .br end .in -.3i Specifying a color table by "percent" values allows one to treat a color table as if it were numbered from 0 to 100. The format of a "percent" value color table specification is the same as for a category value color specification, except that the category values are replaced by "percent" values, each from 0-100, in ascending order. The format is as follows: .in +.3i percent_value% color_name .br percent_value% color_name .br .. .. .br .. .. .br percent_value% color_name .br end .in -.3i Using "percent" value color table specification rules, colors can also be specified by color numbers each in the range 0-255. The format of a percent value color table specification using color numbers instead of color names is as follows: .in +.3i .br percent_value% red_number green_number blue_number .br percent_value% red_number green_number blue_number .br .. .. .. .. .br .. .. .. .. .br percent_value% red_number green_number blue_number .br end .in -.3i Note that you can also mix these three methods of color table specification; for example: .in +.5i \fB0 black .br 10% yellow .br 78 blue .br magenta .br purple .br brown .br 100% 0 255 230 .br end \fR .in -.5i .SH EXAMPLES (1) The below example shows how you can specify colors for a three category map, assigning red to category 1, green to category 2, and blue to category 3. Start by using a text editor, like \fIvi\fR, to create the following rules specification file. Save it with the name \fIrules.file\fR. .in +.5i \fB1 red .br 2 green .br 3 blue .br end \fR .in -.5i The color table can then by assigned to map \fIthreecats\fR by typing the following command at the GRASS> prompt: .RS \fBcat rules.file | r.colors map\*=threecats color\*=rules \fR .RE (2) To create a natural looking LUT for true map layer \fIelevation\fR, use the following rules specification file. It will assign light green shades to the lower elevations (first 20% of the LUT), and then darker greens (next 15%, and next 20%) and light browns (next 20%) for middle elevations, and darker browns (next 15%) for higher elevations, and finally yellow for the highest peaks (last 10% of LUT). .RS .TS r r r r. 0% 0 230 0 20% 0 160 0 35% 50 130 0 55% 120 100 30 75% 120 130 40 90% 170 160 50 100% 255 255 100 .TE .RE .SH SEE ALSO .I d.colormode, .I d.colors, .I d.colortable, .I d.display, .I d.legend, .I p.colors, .I r.support .SH "AUTHORS" Michael Shapiro, U.S. Army Construction Engineering Research Laboratory .br David Johnson, DBA Systems, Inc. supplied the idea to create this program