How to change custom button card color based on status of a group

Topic has been resolved.

type: custom:button-card
name: Sluit alle rolluiken
icon: mdi:window-shutter
hold_action:
  action: none
show_state: true
styles:
  icon:
    - color: |
        [[[
           if (states["group.group_status_alle_somfy_rolluiken"].state != 'closed') return 'red'
           else return 'green'
        ]]]
tap_action:
  action: call-service
  service: cover.close_cover
  service_data: {}
  target:
    device_id:
      - b0d31b5826836dc6eb185dfe41bf07fb
      - ff9380f9744ec162553b9fa98d749aad
1 Like