OpenSCAD User Manual/First Steps/Changing the color of an object

We can change the color of an object by giving it RGB values. Instead of the traditional RGB values from 0 to 255 floating point values are used from 0.0 to 1.0. Note: changing the colors works only in Preview mode (F5); render mode (F6) does not currently support color.

Color names can be used in the 2011.12 version (and newer). The names are the same used for Web colors. For example:

If you think of the entire command as a sentence, then  is an "adjective" that describes the "object" of the sentence (which is a "noun"). In this case, the object is the  to be created. The adjective is placed before the noun in the sentence, like so:. In the same way,  can be thought of as a "verb" that acts upon the object, and is placed like this:. The following code produces the same result:

If colors are nested, the outer-most color "wins" and over-rides any lower-level  statements.