Skip to content

Commit dab85be

Browse files
authored
fix!: state base coloring (#172)
BREAKING-CHANGE: Fix state base coloring by allowing three-state display: state value below limit, state value equals limit and state value above limit. This changes the previous behaviour when the state matches `color_limit` exactly
1 parent bc927e9 commit dab85be

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/chart.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,11 @@ export class Chart extends LitElement {
282282
typeof entityConf.color_below === 'undefined' ? 'var(--primary-color)' : entityConf.color_below;
283283
const colorAbove =
284284
typeof entityConf.color_above === 'undefined' ? 'var(--paper-item-icon-color)' : entityConf.color_above;
285-
finalColor = state > colorLimit ? colorAbove : colorBelow;
285+
if ( state > colorLimit ) {
286+
finalColor = colorAbove;
287+
} else if ( state < colorLimit ) {
288+
finalColor = colorBelow;
289+
}
286290
}
287291

288292
return {

0 commit comments

Comments
 (0)