Skip to content

Instantly share code, notes, and snippets.

@felipecustodio
Created November 2, 2018 05:05
Show Gist options
  • Select an option

  • Save felipecustodio/50facecb329af1114bf286cd118a2d21 to your computer and use it in GitHub Desktop.

Select an option

Save felipecustodio/50facecb329af1114bf286cd118a2d21 to your computer and use it in GitHub Desktop.
Get random colors from color matrix
color[][] colors = { {#f7f4e3,#f9c4aa},
{#fcd77f,#ff2e4c}
{#fcac0c,#ececec}
};
void mouseClicked() {
// get random colorscheme
// (and guarantee it's a new colorscheme)
random_index = (int)random(colors.length);
while (random_index == current_index) {
random_index = (int)random(4);
}
current_index = random_index;
background(colors[random_index][0]);
fill(colors[random_index][1]);
stroke(colors[random_index][1]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment