Allow user to theme all cover states in tile card and more info. (#17898)

This commit is contained in:
Paul Bottein 2023-09-11 18:18:39 +02:00 committed by GitHub
parent 24d401061c
commit d0a60984ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 10 deletions

View File

@ -35,9 +35,8 @@ export class HaMoreInfoCoverPosition extends LitElement {
}
protected render(): TemplateResult {
const forcedState = this.stateObj.state === "closed" ? "open" : undefined;
const color = stateColorCss(this.stateObj, forcedState);
const openColor = stateColorCss(this.stateObj, "open");
const color = stateColorCss(this.stateObj);
return html`
<ha-control-slider
@ -55,6 +54,8 @@ export class HaMoreInfoCoverPosition extends LitElement {
"current_position"
)}
style=${styleMap({
// Use open color for inactive state to avoid grey slider that looks disabled
"--state-cover-inactive-color": openColor,
"--control-slider-color": color,
"--control-slider-background": color,
})}

View File

@ -72,9 +72,8 @@ export class HaMoreInfoCoverTiltPosition extends LitElement {
}
protected render(): TemplateResult {
const forcedState = this.stateObj.state === "closed" ? "open" : undefined;
const color = stateColorCss(this.stateObj, forcedState);
const openColor = stateColorCss(this.stateObj, "open");
const color = stateColorCss(this.stateObj);
return html`
<ha-control-slider
@ -91,6 +90,8 @@ export class HaMoreInfoCoverTiltPosition extends LitElement {
"current_tilt_position"
)}
style=${styleMap({
// Use open color for inactive state to avoid grey slider that looks disabled
"--state-cover-inactive-color": openColor,
"--control-slider-color": color,
"--control-slider-background": color,
})}

View File

@ -64,14 +64,16 @@ class HuiCoverPositionTileFeature
const value = Math.max(Math.round(percentage), 0);
const forcedState = this.stateObj.state === "closed" ? "open" : undefined;
const openColor = stateColorCss(this.stateObj, "open");
const color = this.color
? computeCssColor(this.color)
: stateColorCss(this.stateObj, forcedState);
: stateColorCss(this.stateObj);
const style = {
"--color": color,
// Use open color for inactive state to avoid grey slider that looks disabled
"--state-cover-inactive-color": openColor,
};
return html`

View File

@ -64,14 +64,16 @@ class HuiCoverTiltPositionTileFeature
const value = Math.max(Math.round(percentage), 0);
const forcedState = this.stateObj.state === "closed" ? "open" : undefined;
const openColor = stateColorCss(this.stateObj, "open");
const color = this.color
? computeCssColor(this.color)
: stateColorCss(this.stateObj, forcedState);
: stateColorCss(this.stateObj);
const style = {
"--color": color,
// Use open color for inactive state to avoid grey slider that looks disabled
"--state-cover-inactive-color": openColor,
};
return html`