Skip to content
← p5.jsColor Output Formats
import kleur from "@driangle/kleur";

const color = kleur("#e84393");

// RGB components for fill(r, g, b)
const [r, g, b] = color.toArray();
fill(r, g, b); // fill(232, 67, 147)
ellipse(x, y, size, size);

// Hex string for fill("#...")
fill(color.toHex()); // fill("#e84393")
rect(x, y, size, size);

// CSS string for p5's color()
fill(color.toCss()); // fill("rgba(232,67,147,1)")
triangle(x1, y1, x2, y2, x3, y3);