Trouble with Circle Color Based on Status

Hey, I want the circle to be red when the status is ‘Aus’ and green when the status is ‘ein’, but I just can’t seem to get it right. I use Vertical Stack in Card.

type: custom:vertical-stack-in-card
title: Solaranlage

  • type: glance
    • entity: sun.sun
      name: Sonne
    • entity: sensor.solarzustand
      name: Zustand
      icon: mdi:circle
      - color: |
      if (state === ‘Aus’) return ‘yellow’;
      return ‘grey’;
  1. Format the posted code in accordance to pt.11 of community rules.
  2. You are using a Glance card - which does not have a “styles” option. Check docs for supported options.
  3. A possible way to color an icon dependently on an entity’s state is using a card-mod plugin. Go to card-mod github for docs & installation instructions. Go to the main card-mod thread for learning how to use card-mod, particularly “1st post → link at the bottom → Glance card”.

Suggest to discuss all card-mod related things in THAT thread in future.