Docs β€Ί Color

🌈 Color

Create custom colors with exact red, green, blue, and transparency values. Use this when color names aren't enough!

color(r, g, b, a?)

Creates a color from red, green, and blue values (0–255 each). You can also set transparency with the optional alpha value.

ParameterTypeDescription
rnumberRed (0–255)
gnumberGreen (0–255)
bnumberBlue (0–255)
aoptionalnumberAlpha/transparency (0–255, default 255 = fully opaque)

Returns: A color string you can use with fill(), stroke(), or background()

Tip: Alpha 255 is fully visible, 128 is half-see-through, 0 is invisible. Use transparency for layered effects!
function setup() {
  size(400, 300);
}

function draw() {
  background("white");
  noStroke();

  fill(color(255, 0, 0));
  circle(150, 150, 60);

  fill(color(0, 0, 255, 128));
  circle(250, 150, 60);

  fill(color(0, 200, 0, 100));
  circle(200, 100, 60);
}