CLR Color Spectrum File Format

Color spectrum files .CLR are used to define a spectrum, or continuous gradation of colors. This is specified by a series of anchor points with associated colors. The colors between anchor points are interpolated from the nearest anchor points.

The basic format consists of an ASCII file with header information on the first line. Subsequent lines specify anchors points, one anchor point per line.

The header consists of the following space-delimited fields:

Element

Description

Id

case-sensitive string "ColorMap" without the quotes

Version

format version number, this should be set to 1, 2, or 3

InterpMethod

interpolation method between anchors, this should be set to 1 for versions 1 or 2 and set to the desired interpolation method (0 - 9) for version 3

ColorNodes

the number of color anchor nodes in the CLR file (version 3 only)

OpacityNodes

the number of opacity anchor nodes in the CLR file (version 3 only)

Subsequent lines define the color anchor points, one per line. Alpha is not included in Version 1 files. Each line has the following space-delimited fields:

Element

Description

Position

The position is the floating point percentage value (from 0.0 to 100.0). Positions must be specified in increasing order from 0 to 100 percent, and the 0 and 100 percent positions must be specified in the file.

Red

red color component (0 to 255)

Green

green color component (0 to 255)

Blue

blue color component (0 to 255)

Alpha

opacity component (0 to 255). 0 is fully transparent. 255 is fully opaque.

In version 3 CLR files, the final set of lines define the opacity anchor points, one per line. Each line has the following space-delimited fields:

Element

Description

Position

The position is the floating point percentage value from 0.0 to 100.0. Positions must be specified in increasing order from 0 to 100 percent, and the 0 and 100 percent positions must be specified in the file.

Opacity

The opacity is the floating point percentage value from 0.0 to 100.0.

Examples

In the following example, the anchor points are at 0, 50, and 100. The zero position is a slightly transparent blue, the 50 percent anchor is mostly transparent green, and the 100 percent position is fully opaque yellow.

ColorMap 1 1

0 0 0 255

50 0 255 0

100 255 255 0

ColorMap 2 1

0.000000 0 0 255 200

50.000000 0 255 0 20

100.000000 255 255 0 255

ColorMap 3 0 3 3

0.00000000000000000 0 0 255 255

50.00000000000000000 0 255 0 255

100.00000000000000000 255 255 0 255

0.00000000000000000 78.43000000000000682

50.00000000000000000 7.89473684210526283

100.00000000000000000 100.00000000000000000

It is also possible to have coincident anchor points in a color file. Anchors and colors are interpreted in order from 0 percent to 100 percent. In the case of coincident points, you can create maps with distinct boundaries, similar to the example shown here.

ColorMap 2 1

0.000000 255 0 0 255

50.000000 255 255 0 255

50.000000 0 0 255 255

100.000000 255 255 255 255

ColorMap 3 0 4 2

0.00000000000000000 0 0 0 255

50.00000000000000000 0 220 0 255

50.00000000000000000 136 136 0 255

100.00000000000000000 216 0 216 255

0.00000000000000000 100.00000000000000000

100.00000000000000000 100.00000000000000000

You can find numerous sample .CLR files on the Golden Software website, available for download as a ZIP file within the "Replacement for the ColorScales folder in Surfer" article. A popular .CLR file is RAINBOW.CLR. The following example shows the format of RAINBOW.CLR:

ColorMap 1 1

0 153 102 255

20 0 0 255

40 0 255 0

60 255 255 0

80 255 102 0

100 255 0 0

See Also

Colormap Editor

Contour Map

Color Relief Map

Surface

1-Grid Vector Map

2-Grid Vector Map