Previous:Color Keywords   Main Index   Next:Color Operators



Color Identifiers

Color identifiers may be declared to make scene files more readable and to parameterize scenes so that changing a single declaration changes many values. An identifier is declared as follows.

COLOR_DECLARATION:
#declare IDENTIFIER = COLOR; |
#local IDENTIFIER = COLOR;

Where IDENTIFIER is the name of the identifier up to 40 characters long and COLOR is any valid specification. Note that there should be a semi-colon at the end of the declaration. This semi-colon is new with POV-Ray version 3.1. If omitted, it generates a warning and some macros may not work properly. See "#declare vs. #local" for information on identifier scope. Here are some examples....

 #declare White = rgb <1,1,1>;

 #declare Cyan = color blue 1.0 green 1.0;

 #declare Weird = rgb <Foo*2,Bar-1,Bob/3>;

 #declare LightGray = White*0.8;

 #declare LightCyan = Cyan red 0.6;

As the LightGray example shows you do not need any color keywords when creating color expressions based on previously declared colors. The last example shows you may use a color identifier with the keyword style syntax. Make sure that the identifier comes first before any other component keywords.

Like floats and vectors, you may re-define colors throughout a scene but the need to do so is rare.



Previous:Color Keywords   Main Index   Next:Color Operators