Using Colors

You have two ways to specify colors: (1) using RGB codes or (2) using color names. The syntax rules are

color  rgb< r, g, b >
color  color-name
In the first form, r, g and b are the weights assigned to color red, green and blue. Each weight must be in the range of 0 (no such color component - minimum intensity) and 1 (maximum intensity). The RGB values for common color names are shown below:

Color name Red Green Blue
Black 0 0 0
Red 1 0 0
Green 0 1 0
Blue 0 0 1
Yellow 1 1 0
Magenta 1 0 1
Cyan 0 1 1
White 1 1 1

Thus, to specify white, yellow and cyan, you need the following:

color  rgb< 1, 1, 1 >   // white
color  rgb< 1, 1, 0 >   // yellow
color  rgb< 0, 1, 1 >   // cyan

Since tweaking RGB values is tedious, POVRAY supplies a set of commonly used color names which are defined in POVRAY's include directory. See Local Availability for the details. It must be specified with the +L switch. You can make a copy of colors.inc from there for the correspondence of color names and their RGB values.

To use color name, you have to include the following at the very beginning of your file:

#include  "colors.inc"
After this #include directive, you can use color names defined there. The following four colors ask for color SkyBlue, White, Yellow and PalmGreen.
color  SkyBlue
color  White
color  Yellow
color  PalmGreen