Prevent wrong colors in history timeline for inverted unavailable states (#10137)

This commit is contained in:
Philip Allgaier 2021-10-03 20:35:53 +02:00 committed by GitHub
parent 8e3011807d
commit 375a5323d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,7 +56,11 @@ const getColor = (
entityState: HassEntity,
computedStyles: CSSStyleDeclaration
) => {
if (invertOnOff(entityState)) {
// Inversion is only valid for "on" or "off" state
if (
(stateString === "on" || stateString === "off") &&
invertOnOff(entityState)
) {
stateString = stateString === "on" ? "off" : "on";
}
if (stateColorMap.has(stateString)) {