Skip to content

Instantly share code, notes, and snippets.

@clavis-magna
Created April 16, 2015 00:21
Show Gist options
  • Save clavis-magna/227548db757902ca6056 to your computer and use it in GitHub Desktop.
Save clavis-magna/227548db757902ca6056 to your computer and use it in GitHub Desktop.
processing test colour under the mouse
void setup() {
size(500, 500);
background(255, 0, 0);
}
void draw() {
background(255, 0, 0);
fill(0, 0, 255);
ellipse(250, 250, 50, 50);
color myColor = get(mouseX, mouseY);
if (red(myColor) == 255 && green(myColor) == 0 && blue(myColor) == 0) {
println("it's red");
} else if (red(myColor) == 0 && green(myColor) == 0 && blue(myColor) == 255) {
println("it's blue");
} else {
println("it's something else");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment