I don't know how to get what you want to work specifically with the picture-elements card, but, hopefully, this example for a stock button card will help. (Note: this example handles color, color_temp, and off states.) ```yaml
type: button
show_name: true
show_icon: true
tap_action:
action: toggle
entity: light.living_room_lights
card_mod:
style: |
ha-card {
background: none;
{% if state_attr(config.entity, "color_mode") == "xy" %}
{% set r = state_attr(config.entity, 'rgb_color')[0] %}
{% set g = state_attr(config.entity, 'rgb_color')[1] %}
{% set b = state_attr(config.entity, 'rgb_color')[2] %}
background: rgba( {{r}}, {{g}}, {{b}}, 0.1 );
--card-mod-icon-color: rgba( {{r}}, {{g}}, {{b}}, 1 );
//--primary-text-color: rgba( {{r}}, {{g}}, {{b}}, 0.99 );
//--secondary-text-color: rgba( {{r}}, {{g}}, {{b}}, 0.50 );
{% elif state_attr(config.entity, "color_mode") == "color_temp" %}
--card-mod-icon-color: yellow;
--primary-text-color: white;
{% elif is_state(config.entity, 'off') %}
background: none;
--card-mod-icon-color: rgb(28, 28, 28);
--primary-text-color: rgb(128, 128, 128);
{%- endif %}
}