Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Current fill color in Processing

In Processing, I can call fill(myRGBValue) to set a fill color. Is there a way for me to query for the current fill color?

like image 281
Jean Flower Avatar asked Oct 25 '25 02:10

Jean Flower


1 Answers

Sure, just use something like:

int fillColor = g.fillColor;

g is the name of the default renderer. You can also get the stroke color using g.strokeColor. Both of these take into account noFill() and noStroke().

Note though that will probably only work in the Java version of Processing, not P5.js which works differently under the hood.

like image 99
Bart Avatar answered Oct 26 '25 23:10

Bart