Mushroom Template Change Button color for 1 second when set to toggle

I am brand new to Home Assistant. How do you check a state to see if a button toggle has been pressed? If so, change the button color for 1 second so that you have visual feedback the button was pressed. This is the code I am trying to do. The button works and toggles (momentary contact) the gate and it opens. Problem I am having is the entire button is not the color I want (green) and it is not turning red for 1 second when pressed. I assume I will need some type of timer to switch from red back to green when the 1 second has passed. Any help or suggestions is appreciated. I would assume whatever code that I use, I would need to nest it in between the tap actions but when I tried that I got an error. I have tried this with a mushroom template and mushroom chips card .

type: custom:mushroom-template-card
primary: Gate Opener
icon: mdi:gate
entity: switch.gate
secondary: “”
icon_color: |-
{% if is_state(’ switch.gate’, ‘on’) %}
red
{% elif %}
green
{% endif %}
tap_action:
action: toggle
hold_action:
action: toggle
double_tap_action:
action: toggle