Battery color based on percentage

I just typed in a command to change the battery icon colour depending on it's s percentage. I used this command:

$if(gv(num)>=80,gv(high),gv(num)>60&gv(num)<80,gv(good),gv(num)>40&gv(num)<60,gv(medium),gv(num>20&gv(num)<40,gv(low),gv(critical))$

I made globals for every 'rank' of the battery percentage, so gv(good) is 60-80%, and I have created all the colors globals.

Any tips are appreciated!

I get this error when I finish the command: