Change icon color

Hi ,
i’m a beginner and i’m trying to understand basic function.
I’d like to change the icon color based on the state of a input connected to my ESP32. What i have to do in Home Assistant ?
I defined in esphome a binary sensor as a gpio input, and i see it on HA, but i’d like to see only the icon without any text.
Main goal is to have a card composed by an icon with color controlled by a esp input and a button that controlled an esp output.
EDIT: i add some details to be more clear about the goal:
I have a classic light system based on bi-stable relay and pushbutton, and i’d like to add a software pushbutton a manage it by home assistant. To do that i’d like to use an ESP32 and wiring all like in the picture


in esphome i’m using following code

button:

  - platform: template

    name: "button1"

    on_press:

      then:

        - logger.log: Button Pressed

        - output.turn_on: generic_out

        - delay: 500ms

        - output.turn_off: generic_out

output:

  - platform: gpio

    pin: GPIO18

    id: generic_out

and i have that card in home assistant
immagine
Pushbutton working as i want, but now i’d like to control the icon state with the feedback from K2 (the esp32 input) but i dont’ know how to do it.
Thanks

Changing icon colors isn’t something that native HA can do outside of it being on or off. If you want to supply colors based on state, you’ll have to implement a custom card to handle this.

thanks Petro for your advice.
i have no experience on custom card so i try to investigate if i can reach a solution with standard\existing card with some trick. Do you think that also with “custom button card” i can’t reach the purpose ?