Default [Q] Colouring a progress bar (many conditions)

Hi. I have the following working code to colour a progress bar:
Code:
Select Code
[cf]$#BLEVN#<20?ffec1818$$#BLEVN#>=20 && #BLEVN#<50?ffdfec1c$$#BLEVN#>=50?ff36e057$[/cf]
And I am trying to add another condition (priority):

Code:
Select Code
#BSTATN#=2:ff50e4ff
But I can't put an if inside of another, I've tried many ways (apparently all wrong).

Would you give me a hand?

The objective is: colour if charging. if not charging, colour according to the bat level.