Let’s see, if I get your question right. If I understand correctly, you want to change the appearance of a button when you click on it, is that correct?
If so, I’d suggest (recommend) the use of button-card from RomRaider, you can find it here:
As you can see, there are near endless possibilities to configure anything you want. Different colors, text or whatever depending on the state (or other things), you can even embed other cards into it. To sum it up, if you have something that looks remotely like a button, button-card is your friend.
Look in the corresponding thread for some very in-depth examples, what people achieved with it, here:
And to bring that to the next level, button-card is able to work with it’s own template functionality, so you can split these configurations either internally (button-card) or externally (like you already did).
But I have to warn you, button-card is something that takes a few days to get an oversight, what you can do with it, but once you dive into it, it’s amazing. I’m currently working (together with others) on somewhat like a theme, that only uses button-card. Other cards are only used in an embedded way.