Change icon color based on state

Hi im trying to change my icon color based on a state but i cant get it to work.
i uncommented it for now cause it doesnt work
Im using lovelace if thats in need to know:

############################################
##                   DEFFW01              ##
############################################
###### SENSORS -------------------------------------------------
sensor:
  - platform: template
    sensors:
      deffw01:
        friendly_name: DEF-FW-01
        value_template: "{% if is_state('device_tracker.deffw01', 'home') %}Connected{% else %}!no-reply, please check!{% endif %}"
        icon_template: "{% if is_state('device_tracker.deffw01', 'home') %} mdi:router-wireless{% else %}mdi:lan-disconnect{% endif %}"
#        icon_color: if (state === 'home') return [251, 210, 41]; else return [54, 95, 140];