So i need to change it to a VAR.
This seems to work:
[[[
const fill = 'rgba(255,255,255,0.7)';
const bgColor = '#d9d9d9';
var bgActiveColor = '#4caf50';
const width = 60;
const height = 26;
const dashArray = 2 * (width + height); // Total stroke length
const value = Math.abs(states['sensor.kia_sportage_gt_ev_battery_level'].state);
const dashOffset = dashArray * (1 - value / 100);
if (entity.state === 'home') {
var bgActiveColor = '#000';
}
else if (entity.state === 'home2') {
var bgActiveColor = '#100';
}
return `