Hello,
After hours of debugging i didn’t find the reason of the bug.
My button do not change of color, text did, but not the color :
chips_icon:
template: chips
show_icon: true
size: 80%
show_state: false
tap_action:
action: more-info
entity: '[[[ return variables.entity ]]]'
variables:
icon: "mdi:arrow-left"
entity: "alarm_control_panel.tyxal_alarm"
prefix: ""
icon: '[[[ return variables.icon ]]]'
label: |
[[[
if (states[variables.entity].state == 'disarmed'|| states[variables.entity].state == 'off'){
return variables.prefix + ` Désactivée`
}
if (states[variables.entity].state == 'armed' || states[variables.entity].state == 'on'){
return variables.prefix + ` Activ..e`
}
return '??' ;
]]]
styles:
grid:
- grid-template-areas: '"i l"'
label:
- justify-self: center
- padding: 0px 6px
- font-weight: bold
- font-size: 14px
chips_color:
template: chips
show_icon: true
size: 80%
show_state: false
triggers_update: all
tap_action:
action: more-info
entity: '[[[ return variables.entity ]]]'
variables:
icon: "mdi:arrow-left"
entity: ""
prefix: ""
min: 0
max: 6
icon: '[[[ return variables.icon ]]]'
label: |
[[[
if (states[variables.entity].state < variables.min)
return variables.prefix + " bas"
if (states[variables.entity].state > variables.min && states[variables.entity].state < variables.max)
return variables.prefix + " moyen"
if (states[variables.entity].state > variables.max)
return variables.prefix + " haut"
return '??' ;
]]]
states:
- operator: '>'
value: variables.max
styles:
icon:
- color: 'rgba(var(--color-red),1)'
img_cell:
- background-color: 'rgba(var(--color-red),0.2)'
card:
- background-color: 'rgba(var(--color-background-red),var(--opacity-bg))'
name:
- color: 'rgba(var(--color-red-text),1)'
label:
- color: 'rgba(var(--color-red-text),1)'
- operator: '<'
styles:
icon:
- color: 'rgba(var(--color-green),1)'
img_cell:
- background-color: 'rgba(var(--color-green),0.2)'
card:
- background-color: 'rgba(var(--color-background-green),var(--opacity-bg))'
name:
- color: 'rgba(var(--color-green-text),1)'
label:
- color: 'rgba(var(--color-green-text),1)'
value: variables.min
- operator: 'default'
styles:
icon:
- color: 'rgba(var(--color-yellow),1)'
img_cell:
- background-color: 'rgba(var(--color-yellow),0.2)'
card:
- background-color: 'rgba(var(--color-background-yellow),var(--opacity-bg))'
name:
- color: 'rgba(var(--color-yellow-text),1)'
label:
- color: 'rgba(var(--color-yellow-text),1)'
styles:
grid:
- grid-template-areas: '"i l"'
label:
- justify-self: center
- padding: 0px 6px
- font-weight: bold
- font-size: 14px
- template: chips_color
variables:
icon: "mdi:sunglasses"
entity: "sensor.wattignies_uv"
prefix: "UV :"
min: 3
max: 6
type: 'custom:button-card'
any idea ?
EDIT : theme :
#main interface colors
primary-color: '#434343'
google-red : '#F54436'
google-green : '#01C852'
google-yellow : '#FF9101'
google-blue : '#3D5AFE'
google-violet : '#661FFF'
google-grey: '#BBBBBB'
color-red : 245, 68, 54
color-green : 1, 200, 82
color-yellow : 255, 145, 1
color-blue : 61, 90, 254
color-purple : 102, 31, 255
color-grey : 187, 187, 187
color-pink : 233, 30, 99
color-theme : 51,51,51
color-background-yellow : 250, 250, 250
color-background-blue : 250, 250, 250
color-background-green : 250, 250, 250
color-background-red : 250, 250, 250
color-yellow-text: 'var(--primary-text-color)'
color-blue-text: 'var(--primary-text-color)'
color-green-text: 'var(--primary-text-color)'
color-red-text: 'var(--primary-text-color)'
opacity-bg: '1'
thanks