The Color of a Shape

Every shape must have a color; otherwise, it would be a black spot in the final traced scene. To add a color element to a shape, use pigment {} as follows:
pigment { color  rgb< r, g, b > }  // RGB code
pigment { color  color-name }      // color name
You have to add pigment {} within the shape definition. For example, the following asks for a red sphere with center at the origin and radius 5:
sphere {
     0*x,                // center at < 0, 0, 0 >
     5                   // radius is 5
     pigment {           // color Red here
          color  Red
     }
}
The following asks for a navy blue open cone:
cone {
     -y, 2, y, 1 open
     pigment { color NavyBlue }
}

Mixing Transformations and Pigment

If there are geometric transformations in a shape, in general the order of these transformations and pigment {} are important. More precisely, if transformations appear before pigment {}, then transformations are applied to the shape first, followed by adding the specified color. On the other hand, if pigment {} appears first, then color will be added to the shape, followed by applying transformations. There is no difference for now. But, the order will become important if textures are added to the shape.

The following is a sphere with center < 1, 2, 3 > and radius 10. It is translated, rotated, translated and rotated, followed by coloring it in red.

sphere {
     < 1, 2, 3 >, 10
     translate  < -1, 3, 0 >
     rotate     30*z
     translate  < 5, 3, 1 >
     rotate     -10*y
     pigment { color  NeonBlue }
}
The following is the same sphere; but, red color is added first and then translated, rotated, translated and rotated.
sphere {
     < 1, 2, 3 >, 10
     pigment { color  NeonBlue }
     translate  < -1, 3, 0 >
     rotate     30*z
     translate  < 5, 3, 1 >
     rotate     -10*y
}
If pigment {} contains textures, the above could produce two spheres with different texture pattern.