4.3 The RGB Colour Model

Processing also implements the RGB colour model, and this is what we use if we want fuller access to the colour spectrum. Under the RGB model, three separate numbers represent colours instead of just one. As before, the numbers range from 0 to 255. The three numbers represent the intensities of Red, Green, and Blue (RGB) light, respectively. For example, the RGB value (255, 0, 0) represents pure red because the red component (the first one) is at its maximum value, and the other two components are zero. Similarly, (0, 255, 0) is pure green, (255, 255, 0) is bright yellow since that’s the colour we get from mixing red and green light. (0, 0, 0) gives us black, since it is the absence of any light, and (255, 255, 255) gives us white.

Thinking about colour as a mixture of different colours of light, as done in Processing and almost all digital displays, is known as the additive colour model. This colour model is in contrast to the subtractive colour model, which is the model we use if we’re making colours by mixing paints or dyes; that is why ink for colour printers typically comes in cyan, magenta, and yellow, and not red, blue and green. But the only important thing for us to know right now is that Processing uses the additive, not the subtractive, colour model.