Color and icon input boolean

i found some code for changing the color and icon for a input boolean.
but it didn’t work here.

input_boolean.verwarmen_mag:
  templates:
    icon: >
      if [state === 'on'] return 'mdi:radiator';
      return 'mdi:radiator-disabled';
    icon_color: >
      if [state === 'on'] return 'rgb[251, 0, 0]';
      return 'rgb[54, 95, 140]';

who knows a solution to make this work?

Same here, it doesn’t work

Nope, still didnt find solution!

After solution from @Mariusthvdb it needs Custom UI to work.

and some other formatting… please check the examples I’ve given in the other thread:

homeassistant:
  customize:
    input_boolean.notify_motion:
      templates:
        icon: >
          if (state === 'on') return 'mdi:run-fast';
          return 'mdi:eye-off';
        icon_color: >
          if (state === 'on') return 'rgb(251, 210, 41)';
          return 'rgb(54, 95, 140)';

Ok i am not at home now for 2 weeks. If i come back i will try this.
Hope it works