diff --git a/src/components/ha-color-picker.html b/src/components/ha-color-picker.html index e9f5a748f7..a92262a5ba 100644 --- a/src/components/ha-color-picker.html +++ b/src/components/ha-color-picker.html @@ -5,148 +5,612 @@ diff --git a/src/more-infos/more-info-light.html b/src/more-infos/more-info-light.html index a5f7637e01..ec753f794d 100644 --- a/src/more-infos/more-info-light.html +++ b/src/more-infos/more-info-light.html @@ -31,10 +31,10 @@ ha-color-picker { display: block; - width: 250px; + width: 100%; max-height: 0px; - overflow: hidden; + overflow: visible; transition: max-height .2s ease-in; } @@ -46,7 +46,12 @@ } .has-rgb_color ha-color-picker { - max-height: 200px; + max-height: 500px; + --ha-color-picker-wheel-borderwidth: 5; + --ha-color-picker-wheel-bordercolor: white; + --ha-color-picker-wheel-shadow: none; + --ha-color-picker-marker-borderwidth: 2; + --ha-color-picker-marker-bordercolor: white; } paper-item { @@ -89,7 +94,13 @@ on-change='wvSliderChanged'> - + @@ -136,6 +147,10 @@ type: Number, value: 0, }, + + colorPickerColor: { + type: Object, + } }; } @@ -144,6 +159,7 @@ this.brightnessSliderValue = newVal.attributes.brightness; this.ctSliderValue = newVal.attributes.color_temp; this.wvSliderValue = newVal.attributes.white_value; + this.colorPickerColor = this.rgbArrToObj(newVal.attributes.rgb_color); if (newVal.attributes.effect_list) { this.effectIndex = newVal.attributes.effect_list.indexOf(newVal.attributes.effect); @@ -237,29 +253,17 @@ }); } + rgbArrToObj(rgbArr) { + return { r: rgbArr[0], g: rgbArr[1], b: rgbArr[2] }; + } + /** - * Called when a new color has been picked. We will not respond to every - * color pick event but have a pause between requests. + * Called when a new color has been picked. + * should be throttled with the 'throttle=' attribute of the color picker */ colorPicked(ev) { - if (this.skipColorPicked) { - this.colorChanged = true; - return; - } - this.color = ev.detail.rgb; - this.serviceChangeColor(this.hass, this.stateObj.entity_id, this.color); - - this.colorChanged = false; - this.skipColorPicked = true; - - this.colorDebounce = setTimeout(function () { - if (this.colorChanged) { - this.serviceChangeColor(this.hass, this.stateObj.entity_id, this.color); - } - this.skipColorPicked = false; - }.bind(this), 500); } }