Sensor By State By Icon By Color

Hello Expert

i am trying to create a template that will change according to State , Icon and Color

i was able to create sensor that give change according to the state and Icon BUT not the color

Matrix
State======Icon===========Color
0, 1------------------------mdi:fire-circle-----------------Green
2,3,4,6,7,8,9-------------mdi:timer-sand-full---------Yellow
5---------------------------mdi:radiator--------------------Green

Any help would be appreciated

============================
- platform: template
sensors:
heater_by_color:
friendly_name: “heater_by_color”
value_template: >-
{% if is_state(“sensor.heater_thermostat_run_state_2”, “0”) %}
Stopped/Ready
{% elif is_state(“sensor.heater_thermostat_run_state_2”, “1”) %}
Stopped/Ready
{% elif is_state(“sensor.heater_thermostat_run_state_2”, “4”) %}
Ignited
{% elif is_state(“sensor.heater_thermostat_run_state_2”, “5”) %}
Running
{% elif is_state(“sensor.heater_thermostat_run_state_2”, “6”) %}
Stopping
{% elif is_state(“sensor.heater_thermostat_run_state_2”, “7”) %}
Shutting down
{% elif is_state(“sensor.heater_thermostat_run_state_2”, “8”) %}
Cooling
{% elif is_state(“sensor.heater_thermostat_run_state_2”, “9”) %}
Heating glow plug
{% else %}
Suspended
{% endif %}
icon_template: >-
{% if is_state(“sensor.heater_thermostat_run_state_2”, “0”, “1” ) %}
mdi:fire-circle
{% elif is_state(“sensor.heater_thermostat_run_state_2”, “2”, “3”, “4”, “6”, “7”, “8”, “9”) %}
mdi:radiator
{% else %}
mdi:timer-sand-full
{% endif %}