Enter a ZIP code to get a forecast:
Setup Location

WRN Logo

Graphics Color Resources

Colors and Color Table File

The colors used by WXP are defined in the wxp.clr color table file and are read in by the program shortly after the graphics window opens.  The colors are specified as: optional color index, color name and the appropriate RGB color fractions (0-1).  By default, WXP uses the following color table:

[ind] name      red    green   blue
     Black      0.0     0.0     0.0
     White      1.0     1.0     1.0
     Red        0.7     0.0     0.0
     Green      0.0     0.7     0.0
     Blue       0.0     0.0     0.7
     Yellow     1.0     1.0     0.3
     Cyan       0.0     0.7     0.7
     Magenta    0.7     0.0     0.7
     DGray      0.3     0.3     0.3
     LGray      0.7     0.7     0.7
     LRed       1.0     0.3     0.3
     LGreen     0.3     1.0     0.3
     LBlue      0.3     0.3     1.0
     Brown      0.7     0.7     0.0
     LCyan      0.3     1.0     1.0
     LMagenta   1.0     0.3     1.0

Even though only 16 colors are specified, a total of 256 colors can be allocated. If the index is not specified, the indices start with 0 and increment by one for each line in the file.  To change the color table, the color_table can be specified with a new color table filename that is formatted the same as the above list. More than one color table can be listed separated by commas.  The programs use color names based on the default color table so it is useful to have these colors in any color table that is used. 

Color Tables and the Color Fill Resource

In most cases, the color_fill resource is set manually.  This resource defines a set or range of colors to use in color fill contours.  In most cases, the color fill resource is set to a range of colors in the color table such as "0-23".  To simplify the process, the color fill resource is automatically set to the colors in the first color table file specified in the color_table resource.   For example:


If the rainbow.clr color table file has 24 colors in a rainbow progression in it, the color fill resource is set to 0-23 by default.  If the rainbow color table has more than 24 colors in it, the keyword "end" can be inserted into the file after the last color to be used in the color fill.

   MBRed      0.8  0.   0.
   MRed       0.6  0.   0.
   DRed       0.4  0.   0.
   White      1.   1.   1.

Colors and Color Resources

Each type of graphic whether it is a line or text will be plotted in a specific color based on the above list.  The colors can be changed by specifying the appropriate resource for that graphical item. For example, the color_map resource is used to change the color of the background map from the default "red".  The resource can be specified on the command line:

   sfcwx -com=lblue

to change the color of the map to light blue. The color name "Off" can be specified to turn the display off for that particular piece of information. This is particularly important for overlays. If Black is used, the object is still plotted but in black resulting in a destructive overlay. Also, the value "End" can be used to delimit the end of a color fill color list.

Allocating Colors to Colormaps

If using a windowing system, the result of specifying a color table is to allocate those colors in the server's default color database or colormap. This means that while the window appears on the screen, those colors cannot be changed. When the window is closed, those colors are deallocated so that other programs can use those color indices.

NOTE: When plotting to an already opened window (device=w), the colors have to be allocated by the program which opened the window (i.e. wxploop). Since the program that opened the window is the only program that can allocate colors to a colormap, it is necessary to make sure this program allocates the color that may be used in the plots.  If the plotting program allocates the colors, they will be deallocated once the plotting program ends and the next plotting program could overwrite and change the colors from the original plot. In other words, when running wxploop, make sure it allocates all the colors needed in the plot:

   wxploop -ct=wxp.clr,rainbow.clr

Special Printer Colors

For Postscript output, several special color values can be used. These colors can change line thickness and color but are not valid for display or window output. These values are:

Printer Color Description
pblk Thin black line (.2 pica)
pbblk Bold black line (.8 pica)
ptblk Thick black line (1.6 pica)
pgry Thin gray line (.2 pica)
pbgry Bold gray line (.8 pica)
ptgry Thick gray line (1.6 pica)
pwht Thin white line (.2 pica)
pbwht Bold white line (.8 pica)
ptwht Thick white line (1.6 pica)

Also, the line thickness can be changed with the width graphics attribute (wi=width).

Direct Colors

There are times when a color needs to be specified that is not listed in a color table. These can be used in place of the color names from the color table.  The syntax is #rrggbb.   Each color gets a 2 digit hexadecimal number.  No color is 00 and maximum color is ff. For example:


This would create and allocate a color that is 100% red, 50% green and 75% blue. From this point forward in the program, the name designation #ff80a0 will work but this is not recommended since this is not pre-allocated in the color table.  This color could inadvertently get changed.  This is not a problem on 16 or 24 bit displays.

Read/Write Colors

WXP uses read/write colors whenever possible to enable program to flash color values. Read only colors are allocated based on color.  If there is another color identical to the one being allocated, it is not allocated and the identical color used.  Since read/write colors are allocated based on index and not color, identical colors will get different color indices that may run the colormap out of colors. To disable read/write colors, specify the norwclr plot parameter.

Local Colormaps

In some cases, it is necessary to allocate a local colormap for processing images. This can happen when working on servers that have several windows active each allocating their own colors (such as Netscape). Often when these programs are running, there are few if any colors available in the default colormap.  When a WXP program then tries to allocate a color, it fails and returns the closest available color that might not even be close. The results are graphics with few colors, often unreadable. With a local colormap, the program has access to all 256 colors in the colormap and not just those that have not been allocated. To use a local colormap, the wxplocal_cmap environment variable can be specified (LOCAL_CMAP can be used):

   setenv wxplocal_cmap on

or the lcmap plot parameter can be specified.

NOTE:  On some displays, a local colormap means the colors are only preserved with the cursor is actually in the window (window focused). This means the colors will flash and change to other colors once the cursor leaves the window or another window is raised.  This might be an undesirable result.

NOTE: 16 and 24 bit displays do not have colormaps.

Graphics Resources and Attributes

WXP graphics programs will recognize attribute descriptions appended to the end of the various color resources. These attributes include line width, style, fill patterns, text width, height and thickness. The color resource syntax is:


Here is a list of the possible attributes:

Attribute Description
co=color Specifies the color.  This is the color name from the color table.  If this is the first attribute, the "co=" may be omitted.
wi=width Specifies the width of lines.  This includes lines used in text and markers. The default value is 1.0.
st=style Specifies the style of lines.  Possible values are:
  • sol - solid lines (number 1)
  • dsh - dashed lines (number 2)
  • lsdsh - long short dashed lines (number 3)
  • llsdsh - long, long, short dashed lines (number 4)
  • dot - dotted lines (number 5)
  • # - a number corresponding to the above styles
fo=font Specifies the font name.  See the font_list resource.
Specifies the fill pattern. Possible values are:
  • sol - solid fill (number 0)
  • st - stippled fill (number 1)
  • ost - open stippled (number 2)
  • rst - random stipple (number 3)
  • lst - large stipple (number 4)
  • vln or || - vertical lines (number 5)
  • drl or // - diagonal lines moving to upper right (number 6)
  • dlr or \\ - diagonal lines moving to lower right (number 7)
  • hln or -- - horizontal lines (number 8)
  • hat or XX - hatched lines (number 9)
  • 0% - 0 % fill (number 10)
  • 1% - 11% fill (number 11)
  • 2% - 22% fill (number 12)
  • 3% - 33% fill (number 13)
  • 4% - 44% fill (number 14)
  • 5% - 55% fill (number 15)
  • 6% - 66% fill (number 16)
  • 7% - 77% fill (number 17)
  • 8% - 88% fill (number 18)
  • 9% - 100 % fill (number 19)
  • ## - a number associated with the above patterns
Specifies the scale factor.  For text, this is the text height. For markers, this is the size of the marker. The default value is 1.0.
te=expan Specifies the text expansion factor. This controls how wide text is plotted. An expansion factor greater than 1 results in fat text. A value less than 1 results in thin text. The default value is 1.0.

Each of these can be specified with single characters (backward compatible with version  4). For example "w1.0" can be used for width, "h1.0" can be used for height, "s3" can be used for style, "f8" can be used for fill pattern, "t2" can be used for font, and "e1.0" can used for text expansion.

NOTE: Fill patterns may not work with Windows 95, 98 or NT for overlays.

Fill Contour Colors and Attributes

The color_fill resource allows a great deal of tailoring of contour plots and satellite images. The syntax for each color fill parameter is:


In the simplest form, the color fill list is just a list of colors to be used by the program to display color fill contours.  The first color is associated with the lowest contour value unless changed with the con_base resource.


Each color may also have attributes listed that modify the appearance of the color fill contours.


which uses a different fill pattern for the first color fill range. This can be used in conjunction with line contours if the color_cont resource is set to "off". These attributes can be used to tailor the lines:


which is used to make every 5th line solid and all others dotted.

Color ranges may also be specified to simplify the list. For example:

   2-4 or red-blue

would be equivalent to red,green,blue. The attributes for the entire range come from the attributes listed for the first color in the range.

Finally, values can be attached to each color fill value.  This locks in a particular color to a specific contour range and can specify contour values that are not regular and thus cannot be specified with the con_interval resource.


This specifies the color fills for a precipitation field. When values are specified, a color bar automatically appears since this is necessary to denote irregular contour values.

As color fill settings get more complicated, it becomes more convenient to put the values in a file. WXP has a color fill file that can be specified with the color_fill resource:


The file has the same information except the values are put of different lines without the commas:


Up to 256 color fill values can be specified.

Contour Labels

The labels on the contour plot and color bar are based on the value listed. For example, the first value listed would be labeled ".01". To change this label, use the label parameter ".01:DDMagenta:la=min" or "85:red:la=HOT".

Satellite Enhancement

Satellite enhancement uses the existing color fill setup where values can be specified for colors. The major differences are as follows:

  • The color values are image pixel values ranging from 0 to 255.
  • The value may be specified as an image pixel value or as a infrared temperature based on the GOES conversion scheme.  The value is preceded by a "c" if it is a temperature. For example, "c-25" specifies the image pixel value corresponding to -25 Celsius. This way infrared images can be enhanced based on the temperatures the image represents.
    NOTE: This works only for increasing image pixel values. As the image pixel values increase, the temperatures DECREASE and therefore temperature values must be listed in decreasing order.
  • The colors can be specified with dither value and color. This is handy for screens that cannot support gray shades such as monochrome displays. Dither colors are specified by using the following syntax:


    The original or background color is specified followed by a "%", then the dither percent value and the dither or foreground color. The above example uses the 3x3 dither matrix and gives possible dither values of 0 through 9. The result is a 6/9 dither of white over black. Using 0 for the dither value gives the original color. Using 9 for the value gives the only dither color. This is somewhat restrictive for monochrome screens, so a second dither scheme is provided which is a 5x5 dither matrix. This gives a total of 26 possible dither values that are specified by lower case alphabetic characters "a" through "z". The value "a" gives the original color and "z" gives the dither color. For example:


    gives a 12/25 dither.

The color fill file or more appropriately the enhancement file has an additional line at the beginning of the file that names the enhancement. Here is the MB enhancement file:


For further information about WXP, email technical-support@weather.unisys.com
Last updated by Dan Vietor on July 21, 1998