Palettes

You can also specify the palette that is used for displaying the image. The pixel value computed with the benes described above specifies an index of 0 to 255 into the palette. The Red, Green and Blue components of the palette are specified separately using assignments to the variables r,g and b. When palette benes are evaluated x is used to indicate the current palette index being computed. Thus the default palette of a gray wash is specified via

r=x
g=x
b=x

If you wanted a blue wash you would specify the palette with

r=0
g=0
b=x

You may also use the Hue, Saturation, Lightness (HSL) color model to specify color. It is often much easier to create a good palette using HSL. H specifies the hue (0..255 map to Red-Yellow-Green-Cyan-Blue-Magenta). S is color saturation (0..255) and L is lightness (0..255 map to black-white). A nice rainbow swash can be specified by:

h=x
s=255
l=128

Palettes may also be specified using assignments to p. Use the pal(x, offs) function when using p. The first argument to pal specifies the index into an array of predefined palettes (currently about 30). offs specifies the offset whithin the palette (0..255). Thus

p=pal(13,t)

will rotate palette 13.