Step 4. Chaos colors

We’ve been using random() to vary our shapes’ positions and sizes, and we can do the same to their colors.

You might remember the fill(r, g, b) command. It takes three parameters (red, green, and blue) to change the colors of our shapes. Note that 255 is the highest value possible and 0 is the lowest.

fill(0, 0, 0); // black
fill(255, 255, 255); // white
fill(100, 100, 100); // grey
fill(255, 0, 0); // red
fill(0, 255, 0); // green
fill(0, 0, 255); // blue

In the above example, the values never change, but what happens if we use random() instead?

fill(random(0, 255), random(0, 255), random(0, 255)); // random colors!
Translate this to plain English

⌨️ Add the random fill() function to brush 3

if(brush == 3) {
	fill(random(0, 255), random(0, 255), random(0, 255)); // randomized fill!
  square(10, -10, 20);
  circle(-10, 10, 20);
}

Next up…

Step 5. YourBrush