HOW TO: Play-button colour change [SOLVED!]

Hey guys!

First of all - i am so completely blown away by BTT!!
My Macbook Pro M1 went from great to greatest because of this!

HOWEVER!
I've been trying to figure out how to make my play-button change to green whenever something is playing. I've learned a whole lot of pressing buttons and tweaking different things in BTT, and it seems to me that to get what i want, i have to use AppleScript - but that is waaaay out of my league!

I need some help to have i can check if something is playing, and if it is so, then my Playbutton has to turn green. I know this should be a thing because i have a mute-button which does this exact thing. Here is the script:

set currentVolume to get volume settings
if output muted of currentVolume is true then
	return true
else
	return false
end if

PLEASE HELP! I am way over my head here :smiley:

FIGURED IT OUT! :slight_smile:

Use this code as a Touchbar Widget -> Apple Script / Java Script

set playState to "stopped"

if application "Spotify" is running then
	tell application "Spotify"
		if (player state as string) is equal to "paused" or (player state as string) is equal to "stopped" then
			return "showPlay"
		else
			return "showPaused"
		end if
	end tell
end if

if application "iTunes" is running then
	tell application "iTunes"
		if (player state as string) is equal to "paused" or (player state as string) is equal to "stopped" then
			return "showPlay"
		else
			return "showPaused"
		end if
	end tell
end if

return "showPlay"

Remember to set Execute Script to a low ratio to make it change as you press the button. Mine is set to 0,05

Choose: "Common"-tab
In "Alternate Color Regex" - type "showPaused"

Change the Alternate Background Colour to your prefered colour

If you wish to change the Icon do it here as well. I've just used SF Symbols and typed "playpause".