Examples Color

Color

This expands on the Shape Primitives example by adding color. background() fills the canvas with one color, stroke() sets the color for drawing lines, and fill() sets the color for the inside of shapes. noStroke() and noFill() turn off line color and inner color, respectively.

Colors can be represented in many different ways. This example demonstrates several options.

Color: Created by Caleb Foss, Darren Kessner. From 2024 onwards, edited and maintained by p5.js Contributors and Processing Foundation. Licensed under CC BY-NC-SA 4.0.

You can find the code history of these examples here: 2023 code. You can suggest improvements by contributing to the current website!