How to get the color of a square or rectangle etc

size(500, 500);
background(111, 0, 0);
fill(0, 125, 0);
square(100, 100, 100);
color c = get(150, 150);
println(red(c));
println(green(c));
println(blue(c));

The result of get() is the color of the background, not of the square.

You might want to try adding pixelDensity(1) at the top of your sketch.

1 Like

Voila! Thank you very much!

1 Like