Mini-graph-card Change icon to reflect switch state?

After some forum searches and trial and error I have got my card looking like this. At the moment it has a switch at the top so that I can turn the lamp on/off. My goal is to not have the separate switch above the chart…


Using the tap_action I can now turn the lamp on/off by tapping the icon, now I’m trying to figure out how I can change the colour of the icon to indicate the status of the switch???

Even better would be the ability to show the actual switch in the chart like this photoshop mockup… But I don’t think that’s possible :slight_smile:


type: custom:stack-in-card
mode: vertical
  background: true
  border_radius: true
  margin: false
style: |
  ha-card {
   border-radius: 10px;
   background-color: rgba(0, 100, 0, 0.2);
  - type: entities
      - switch.xiaomisocket03
  - type: custom:mini-graph-card
    name: Linita's Lava Lamp
    icon: mdi:lava-lamp
    align_icon: state
      action: call-service
      service: switch.toggle
        entity_id: switch.xiaomisocket03
    smoothing: true
    hours_to_show: 1
    points_per_hour: 60
    update_interval: 60
    line_width: 2
    line_color: orange
    animate: true
    height: 100
      - sensor.xiaomisocket03_power
      graph: line
      average: false
      extrema: false
      labels: false