Change badge colour

Hi all,
I’m new here and really enjoying learning about HA which is awesome. Thank you to all the talented devs out there making this happen for plodders like me.

Can someone help me please ? I am trying to change the colour of temperature badges at the top of a panel. I have read through so many different methods and have failed to get any of them to work. In my config file I have: (thanks to @davefi !)

homeassistant:
  customize:
    sensor.netatmo_greenacres_master_bedroom_temperature:
      templates:
        theme: >
          if (state > 25) {
            return 'hot';
          } else if (state >= 18 ) {
            return 'comfortable';
          } else {
            return 'cold';
          }

frontend:
  themes:
    cold:
      primary-text-color: "#447ebc"
      label-badge-red: "#4629e51"
    comfortable:
      primary-text-color: "#629e51"
      label-badge-red: "#629e51"
    hot:
      primary-text-color: "#bf1b00"
      label-badge-red: "#bf1b00"`

I can see the theme listed in the sensor templates and if I manually select the theme in the visual editor the text will change colour. However I have no idea how to affect the badge. I have installed card-mod and also played around with custom_ui but cant see if this is deprecated now.
Please would someone be kind enough to walk me through it ?!

Many thanks,

Andrew.