void setup() { size(800, 600); background(255); // white background noStroke(); // De Stijl color palette color[] palette = { color(0, 125, 125), // teal color(0, 0, 255), // blue color(255, 221, 0), // yellow color(0), // black color(200) // grey }; int gridSize = 100; int padding = 18; // thicker white space between boxes for (int x = 0; x < width; x += gridSize) { for (int y = 0; y < height; y += gridSize) { if (random(1) < 0.5) { fill(palette[int(random(palette.length))]); // Random width and height in multiples of gridSize int w = gridSize * int(random(1, 3)); // 1 to 2 grid units wide int h = gridSize * int(random(1, 3)); // 1 to 2 grid units tall // Ensure the shape fits inside the canvas if (x + w <= width && y + h <= height) { rect(x + padding / 2, y + padding / 2, w - padding, h - padding); } } } } }