If or if, then

I want to be able to say that if the music player is stopped or if the music player is spotify, then make the color green. I can't figure out how to do this. Please help.

So let's say you have a shape and you want to change its color based on the fact that music is stopped or playing, lets make it green if playing and red if not

  • Open the Editor and Create a Shape using the "+" on the top right
  • Change the Shape aspect according to your needs
  • Go in the "Paint" section and select the color preference
  • On the top bar the "Formula" icon will appear, select it
  • Now the preference has been switched to a "Formula" preference so it's now controlled by an expression rather than a simple value, click the preference to edit the Formula
  • Type $if(mi(state) = PLAYING, #00FF00, #FF0000)$ and press the "ok" button on top right

If you want to change it when player is spotify you can use:

  • $if(mi(pkg) = com.spotify.music, #00FF00, #FF0000)$

If instead you want it green only when its BOTH playing AND Spotify use

  • $if(mi(pkg) = com.spotify.music & mi(state) = PLAYING, #00FF00, #FF0000)$