make icon_color more readable

This commit is contained in:
Ranlvor 2018-08-11 22:17:22 +02:00
parent 4f3a6214a1
commit 172dc5d0c5
Signed by untrusted user who does not match committer: Ranlvor
GPG key ID: 5E12D04750EF6F8E

View file

@ -64,9 +64,16 @@ export const tasmota = {
defaultValue: "offline" defaultValue: "offline"
}, },
}), }),
icon_color: function (name: string, on_color: Color = hex("#00FF00")) { icon_color: (name: string, on_color: Color = hex("#00FF00")) => function (state: State) {
return (state: State) => if (state[`${name}_online`] == "offline") {
state[`${name}_online`] == "offline" ? hex("#888888") : (state[name] == "on" ? on_color : hex("#000000")) return hex("#888888")
} else {
if (state[name] == "on") {
return on_color
} else {
return hex("#000000")
}
}
} }
} }
export const floalt = { export const floalt = {