How do I change a battery progress bar to green when charging?

I tried the formulas found in the tutorials and other questions but nothing worked. Im using a Progress battery bar, linear, flat progress. Thanks in advance!

Forget it, I figured it out.

Thanks for a great app!

Just as a reference for anyone who might stumble into this:

  • Select the color option in the progress bar style
  • Turn it into a formula
  • Write something like $if(bi(charging), #00FF00, #FF0000)$

This will turn it into red when not charging green when charging.

My code is:

$if(bi(charging) = 0, #000000, 1, #00FF00)$

Green when charging, black discharging.