4.2.3 Fill Colour

The fill() function sets the default colour that Processing will use to fill the middle of the shapes that it draws. Conceptually, it’s the same as the stroke() function in that when you call it once, all subsequent shapes will use the new colour until the fill() function gets called again to set a different colour. The following program uses the fill() function to draw a white box and a black box on the default gray background.

The only extra thing we’ll note here is that the outline for the white box is still clearly black (and so is the outline of the black box), even though the middle of the box is white. If we wanted the box to be completely white, we’d have to change both the stroke colour and fill colour like so: