Declare and use array of colors

I have a list of rgb colors.
I want to store them in an array,
and while running, choose randomly index.

since the fill function require 3 numbers,
I wonder how to declare it and use it

color[] listCol = new color[5];

fill(listCol[index]);

1 Like

“Wonder is the beginning of wisdom.” - Socrates

The Processing website has resources (tutorials, references and examples) here:
https://processing.org/

The fill() function accepts:

Reference for the color datatype:
color \ Language (API) \ Processing 3+

Example:

color c = #FF00FF; //Fuchsia

color[] col = {
              color(255, 0, 0), // Red
              0xFF00FF00,       // Green
              #0000FF,          // Blue
              c
              };

:)

1 Like