mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-09 02:49:51 +00:00
Migrate light to use RGB instead of XY color
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
import Polymer from '../../polymer';
|
||||
|
||||
import xyBriToRgb from '../../util/xybri-to-rgb';
|
||||
|
||||
require('./domain-icon');
|
||||
|
||||
export default new Polymer({
|
||||
@@ -20,11 +18,8 @@ export default new Polymer({
|
||||
updateIconColor(newVal) {
|
||||
// for domain light, set color of icon to light color if available
|
||||
if (newVal.domain === 'light' && newVal.state === 'on' &&
|
||||
newVal.attributes.brightness && newVal.attributes.xy_color) {
|
||||
const rgb = xyBriToRgb(newVal.attributes.xy_color[0],
|
||||
newVal.attributes.xy_color[1],
|
||||
newVal.attributes.brightness);
|
||||
this.$.icon.style.color = 'rgb(' + rgb.map(Math.floor).join(',') + ')';
|
||||
newVal.attributes.rgb_color) {
|
||||
this.$.icon.style.color = 'rgb(' + newVal.attributes.rgb_color.join(',') + ')';
|
||||
} else {
|
||||
this.$.icon.style.color = null;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import Polymer from '../../polymer';
|
||||
|
||||
import xyBriToRgb from '../../util/xybri-to-rgb';
|
||||
|
||||
require('./ha-state-icon');
|
||||
|
||||
export default new Polymer({
|
||||
@@ -20,11 +18,8 @@ export default new Polymer({
|
||||
updateIconColor(newVal) {
|
||||
// for domain light, set color of icon to light color if available
|
||||
if (newVal.domain === 'light' && newVal.state === 'on' &&
|
||||
newVal.attributes.brightness && newVal.attributes.xy_color) {
|
||||
const rgb = xyBriToRgb(newVal.attributes.xy_color[0],
|
||||
newVal.attributes.xy_color[1],
|
||||
newVal.attributes.brightness);
|
||||
this.$.icon.style.color = 'rgb(' + rgb.map(Math.floor).join(',') + ')';
|
||||
newVal.attributes.rgb_color) {
|
||||
this.$.icon.style.color = 'rgb(' + newVal.attributes.rgb_color.join(',') + ')';
|
||||
} else {
|
||||
this.$.icon.style.color = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user