button-card icon indicating copy to clipboard operation
button-card copied to clipboard

Unable to set button card color when entity is a script

Open ShazAu opened this issue 8 months ago • 1 comments

Checklist

  • [X] I updated the card to the latest version available
  • [X] I cleared the cache of my browser

Describe the bug When using a custom button card to toggle a script you are unable to set the card colour

Version of the card Version: 4.1.2

To Reproduce This is the configuration I used:

type: custom:button-card
color_type: card
color: yellow
entity: script.reset_washing_machine_filter_date_to_today
show_name: true
show_icon: false
tap_action:
  action: toggle
name: Tap to Complete Task
grid_options:
  columns: full
  rows: 1

Expected behavior To be able to change the color of the button card when the entity is a script

Desktop (please complete the following information):

  • Firefox 137.0.2

Smartphone (please complete the following information):

Additional context I was trying to change the colour of this button card to show that it performed an action rather than just being a static tile. As soon as the entity type is a script it seems to set some sort of default color that you are unable to change. It doesn't matter how the colour is defined (rgb or name). I've tried adding show_state to confirm the default button state is off, and then adding a color state for off with no effect.

ShazAu avatar Apr 24 '25 05:04 ShazAu

Seems that all domains are affected when using color_type: card

pedolsky avatar May 06 '25 07:05 pedolsky

Script state is 'off' when not in use so the card will show disabled state.

Alternatively you can achieve the same style with

type: custom:button-card
entity: script.blank_script
state:
  - value: 'off'
    styles:
      card:
        - color: black
        - background: yellow

dcapslock avatar Jul 30 '25 07:07 dcapslock

This has been bugging me for a while. Tried the suggestion above, didn't work for me. I have card-mod installed and this worked:

card_mod: style: | ha-state-icon { {% if states('script.car_locator_lights') == 'on' %} color: gold !important; {% else %} color: grey !important; {% endif %} }

erbha21 avatar Aug 04 '25 19:08 erbha21