Having been trying to do operations like that myself I was wondering the same…
Would seem the way forward for the button card, to be independent of all these other cards, and introduce a true style_template option. Please consider doing so?
Something like coloring the volume like this would be awesome:
icon_color: >
if (state === '0.0') return 'rgb(145,227,237)';
if (state <= '0.1') return 'rgb(105,212,231)';
if (state <= '0.2') return 'rgb(46,147,238)';
if (state <= '0.3') return 'rgb(0,220,16)';
if (state <= '0.4') return 'rgb(0,195,13)';
if (state <= '0.5') return 'rgb(250,255,0)';
if (state <= '0.6') return 'rgb(252,150,0)';
if (state <= '0.7') return 'rgb(218,53,0)';
if (state <= '0.8') return 'rgb(255,0,0)';
if (state <= '0.9') return 'rgb(154,0,0)';
if (state <= '1.0') return 'rgb(81,0,0)';
I know we could work around this using the operator: template, but it would require a line per state. Using a template like the above would shorten that enormously.
Especially if we could combine things in a style_template even further, like:
style_template: >
if (state > 0) return 'background-color: #f0c209;--tiles-icon-color:#555B65;--tiles-label-sec-color: #555B65;color: #555B65';
return 'background-color: #555B65;--tiles-icon-color:#f0c209;--tiles-label-sec-color: #f0c209;color: #f0c209;text-decoration: line-through';
maybe the latter already is possible, havent tried that tbh, but since I couldn’t find that in the documentation I suppose this shorthand notation isn’t available (yet…)?