Processing specifies colour as additive RGB values (0–255 per channel) with an optional alpha channel
In Processing, colour is specified as three values — Red, Green, Blue — each an integer from 0 to 255, giving about 1.6 million combinations. Colour functions (background(), stroke(), fill()) all use this convention. Mixing is additive, like light on a monitor: full red+green+blue gives white, none gives black. This is the opposite of subtractive pigment mixing, where combining primaries darkens toward black or brown. An optional fourth parameter sets alpha (transparency): 0 is fully transparent, 255 fully opaque; drawing a semi-transparent colour repeatedly in the same spot accumulates toward full opacity. A single value sets grayscale, applying to all three channels equally — background(230) equals background(230,230,230). Hex notation (background(#E6E6E6)) is also accepted. colorMode() can switch the space to HSB (hue, saturation, brightness) for more intuitive gradients. Understanding RGB is prerequisite to all visual work: mixing, alpha compositing, and colour-based generative effects.
Examples
stroke(130, 0, 0); // medium red stroke fill(255, 150); // semi-transparent white fill background(230); // grayscale, same as background(230,230,230) fill(0, 0, 180, 80); // dark blue, transparent fill(255, 0, 0); // pure red — additive colorMode(HSB, 360, 100, 100); fill(210, 100, 40); // deep blue in HSB
Assessment
Write Processing calls to (1) set a mid-grey background, (2) draw a shape with a solid red stroke and semi-transparent yellow fill. (3) Explain why fill(255,255,0,50) drawn many times in one place becomes fully yellow. (4) Explain why fill(255,255,255) produces white on screen but painters cannot mix white from pigments, and predict the result of overlapping fill(255,0,0,128) and fill(0,0,255,128).