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 |
InterpMethod | interpolation method between anchors, this should be set to 1 |
Subsequent lines define the 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 |
Red | red color component (0 to 255) |
Green | green color component (0 to 255) |
Blue | blue color component (0 to 255) |
In the following example, the anchor points are at 0, 50, and 100. The zero position is blue, the 50 percent anchor is green, and the 100 percent position is yellow.
ColorMap 1 1
0 | 0 | 0 | 255 |
50 | 0 | 255 | 0 |
100 | 255 | 255 | 0 |
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 distinct boundaries, similar to the example shown here.
ColorMap 1 1
0 | 255 | 0 | 0 |
50 | 255 | 255 | 0 |
50 | 0 | 0 | 255 |
100 | 255 | 255 | 255 |