mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 17:26:42 +00:00
parent
bbc9e0d071
commit
3fdba35986
@ -24,6 +24,10 @@
|
|||||||
.slider-container {
|
.slider-container {
|
||||||
margin-left: 24px;
|
margin-left: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
paper-slider {
|
||||||
|
background-image: var(--ha-slider-background);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class='title'>[[caption]]</div>
|
<div class='title'>[[caption]]</div>
|
||||||
|
@ -23,6 +23,10 @@
|
|||||||
transition: max-height .5s ease-in;
|
transition: max-height .5s ease-in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.color_temp {
|
||||||
|
--ha-slider-background: -webkit-linear-gradient(right, rgb(255, 160, 0) 0%, white 50%, rgb(166, 209, 255) 100%);
|
||||||
|
}
|
||||||
|
|
||||||
ha-color-picker {
|
ha-color-picker {
|
||||||
display: block;
|
display: block;
|
||||||
width: 250px;
|
width: 250px;
|
||||||
@ -146,17 +150,25 @@ Polymer({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
featureClassNames: {
|
||||||
|
1: 'has-brightness',
|
||||||
|
},
|
||||||
|
|
||||||
computeClassNames: function (stateObj) {
|
computeClassNames: function (stateObj) {
|
||||||
var classes = window.hassUtil.attributeClassNames(
|
var classes = [
|
||||||
stateObj, ['rgb_color', 'color_temp', 'white_value',
|
window.hassUtil.attributeClassNames(
|
||||||
'effect_list']);
|
stateObj, ['color_temp', 'white_value', 'effect_list']),
|
||||||
var BRIGHTNESS_SUPPORTED = 1;
|
window.hassUtil.featureClassNames(stateObj, this.featureClassNames),
|
||||||
// If brightness is supported - show the slider even if the attribute is
|
];
|
||||||
// missing (because the light is off).
|
|
||||||
if (stateObj && (stateObj.attributes.supported_features & BRIGHTNESS_SUPPORTED)) {
|
// Lights that do shades of white can still have an rgb color
|
||||||
classes += ' has-brightness';
|
// In that case we don't want the color picker to show.
|
||||||
|
if (stateObj.attributes.supported_features &&
|
||||||
|
(stateObj.attributes.supported_features & 16) !== 0 &&
|
||||||
|
stateObj.attributes.rgb_color) {
|
||||||
|
classes.push('has-rgb_color');
|
||||||
}
|
}
|
||||||
return classes;
|
return classes.join(' ');
|
||||||
},
|
},
|
||||||
|
|
||||||
effectChanged: function (effectIndex) {
|
effectChanged: function (effectIndex) {
|
||||||
|
@ -46,6 +46,20 @@ window.hassUtil.attributeClassNames = function (stateObj, attributes) {
|
|||||||
).join(' ');
|
).join(' ');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Expects featureClassNames to be an object mapping feature-bit -> className
|
||||||
|
window.hassUtil.featureClassNames = function (stateObj, featureClassNames) {
|
||||||
|
if (!stateObj || !stateObj.attributes.supported_features) return '';
|
||||||
|
|
||||||
|
var features = stateObj.attributes.supported_features;
|
||||||
|
|
||||||
|
return Object.keys(featureClassNames).map(
|
||||||
|
function (feature) {
|
||||||
|
return (features & feature) !== 0 ? featureClassNames[feature] : '';
|
||||||
|
}
|
||||||
|
).join(' ');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
window.hassUtil.canToggleState = function (hass, stateObj) {
|
window.hassUtil.canToggleState = function (hass, stateObj) {
|
||||||
var domain = window.hassUtil.computeDomain(stateObj);
|
var domain = window.hassUtil.computeDomain(stateObj);
|
||||||
if (domain === 'group') {
|
if (domain === 'group') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user