Color Spectrum CLR 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 or 2

InterpMethod

interpolation method between anchors, set to 0

ColorNodes

the number of color nodes

OpacityNodes

the number of opacity nodes

 

Subsequent lines define the anchor points, one per line. Each line in the Color section has the following space-delimited fields:

Element

Description

Position

The position is the floating point value proportion of the colormap (from 0 to 1). Positions must be specified in increasing order from 0 to 1, and the 0 and 1 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)

 

Each line in the Opacity section has the following space-delimited fields:

Element

Description

Position

The position is the floating point value proportion of the colormap (from 0 to 1). Positions must be specified in increasing order from 0 to 1, and the 0 and 1 positions must be specified in the file.

Opacity

The opacity is the floating point value corresponding to the opacity at the node (from 0 to 1)

 

 

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 2 0 3 3

0

0

0

255

 

.5

0

255

0

 

1

255

255

0

 

0

 

 

 

0.78431372549020

.5

 

 

 

0.07843137254902

1

 

 

 

1

 

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. This colormap has a fixed 0.2 Opacity.

 

ColorMap 2 0 4 2

0

255

0

0

 

50

255

255

0

 

50

0

0

255

 

100

255

255

255

 

0

 

 

 

0.2

1

 

 

 

0.2

 

 

The following example shows the format of the Rainbow colormap with a fixed 1.0 Opacity:

 

ColorMap 2 0 6 2

0

153

102

255

 

.2

0

0

255

 

.4

0

255

0

 

.6

255

255

0

 

.8

255

102

0

 

1

255

0

0

 

0

 

 

 

1

1

 

 

 

1

 

 

See Also

ColorMap

Colormap Editor