Change icon color when airpods are connected

I am using better touch tool and have set up an AirPods button on my Touch Bar, that when pressed, connects to my AirPods via bluetooth. I know that there is a way to change an button's color using AppleScript but as I do not know AppleScript, I wasn't sure how to make a script that returns a specific value when my AirPods are connected. Could someone help me out?