What yaml anchor code works here?

have many of these:

    switch.sw_boiler_bijkeuken*:
      templates:
        icon: >
          if (state == 'on') return 'mdi:water-boiler';
          return 'mdi:water-boiler-off';
        icon_color: >
          if (state == 'on') return 'gold';
          return 'steelblue';

where the icon is set per switch, but the coloring is set identical for all switches_*

normally I use anchors like this:

device_tracker.tv_auditorium_samsung_8k:
  templates: &green_color
    icon_color: >
      if (state == 'home') return 'green';
      return 'steelblue';

device_tracker.tv_library_philips:
  templates:
    <<: *green_color

but since I need the anchor to only set the color, and not the icon, I cant use the definition of the anchor after

templates: &state_color

how would I set it to be able to do:

    switch.sw_boiler_bijkeuken*:
      templates:
        icon: >
          if (state == 'on') return 'mdi:water-boiler';
          return 'mdi:water-boiler-off';
        <<: *state_color

btw, I do use state_color option in the Lovelace cards, this is mainly for the more-info windows that are still rather reminiscing to states…

thanks for having a look