Color can be specified for individual drawing statements in a pattern definition, or for the entire pattern in a pattern reference. You cannot specify color for the entire pattern in a pattern definition.
When a pattern reference specifies a color, any drawing statement that is part of the pattern and does not have its own color specification is drawn in the color specified in the pattern reference. In the example of nested boxes:
pattern Cubes is
box 200 200 # Outermost box
move 10 10
red box 180 180 # Middle box
move 10 10
green box 160 160 # Innermost box
move 80 80 # Move to center
the drawing statements that display the two inner boxes have color specifications; the middle box is red and the innermost box is green whenever the pattern Cubes is displayed. The drawing statement that displays the outermost box does not have a color specification. When this box is drawn, it is drawn in the color specified in the pattern reference or the foreground of the referencing object, if no color specification is given.
For example:
aqua pattern Cubes
draws the box in aqua, whereas:
pattern Cubes
draws the outermost box in the foreground color of the graphical object whose contents contain the pattern reference.
If the graphical object that contains this pattern reference has no color specification, the outermost box is drawn in white:
key Shapes at position 300 200
pattern Cubes
If a color has been specified for a particular drawing statement in a pattern definition, it cannot be changed for that drawing statement in any pattern reference.