Current fill color in Processing

colors, processing

Solution

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.

Problem

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?

Original source