Use const in button templates

This commit is contained in:
2020-05-01 16:44:28 +03:00
parent c54bf2efbc
commit 1651250c75
3 changed files with 9 additions and 9 deletions
@@ -39,16 +39,16 @@ progress:
card:
- background: >
[[[
var temp = entity.state;
const temp = entity.state;
var color = temp < variables.normal_value
const color = temp < variables.normal_value
? variables.low_color
: temp < variables.high_value
? variables.normal_color
: variables.high_color;
var percent = (temp - variables.min_value)/(variables.max_value - variables.min_value) * 100;
var gradient = 100 - percent;
var degrees = variables.degrees + "deg";
const percent = (temp - variables.min_value)/(variables.max_value - variables.min_value) * 100;
const gradient = 100 - percent;
const degrees = variables.degrees + "deg";
return 'linear-gradient('+ degrees +', var(--paper-card-background-color) 0%, var(--paper-card-background-color)' + gradient + '%, ' + color + ' ' + gradient + '%)'
]]]