mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Do not color icon if too white
This commit is contained in:
parent
e550b0cec2
commit
f2d9a4f071
@ -16,9 +16,11 @@ export default new Polymer({
|
||||
* Called when an attribute changes that influences the color of the icon.
|
||||
*/
|
||||
updateIconColor(newVal) {
|
||||
// for domain light, set color of icon to light color if available
|
||||
// for domain light, set color of icon to light color if available and it is
|
||||
// not very white (sum rgb colors < 730)
|
||||
if (newVal.domain === 'light' && newVal.state === 'on' &&
|
||||
newVal.attributes.rgb_color) {
|
||||
newVal.attributes.rgb_color &&
|
||||
newVal.attributes.rgb_color.reduce((cur, tot) => cur + tot, 0) < 730) {
|
||||
this.$.icon.style.color = 'rgb(' + newVal.attributes.rgb_color.join(',') + ')';
|
||||
} else {
|
||||
this.$.icon.style.color = null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user