mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Allow user to theme all cover states in tile card and more info. (#17898)
This commit is contained in:
parent
24d401061c
commit
d0a60984ed
@ -35,9 +35,8 @@ export class HaMoreInfoCoverPosition extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
const forcedState = this.stateObj.state === "closed" ? "open" : undefined;
|
const openColor = stateColorCss(this.stateObj, "open");
|
||||||
|
const color = stateColorCss(this.stateObj);
|
||||||
const color = stateColorCss(this.stateObj, forcedState);
|
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<ha-control-slider
|
<ha-control-slider
|
||||||
@ -55,6 +54,8 @@ export class HaMoreInfoCoverPosition extends LitElement {
|
|||||||
"current_position"
|
"current_position"
|
||||||
)}
|
)}
|
||||||
style=${styleMap({
|
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-color": color,
|
||||||
"--control-slider-background": color,
|
"--control-slider-background": color,
|
||||||
})}
|
})}
|
||||||
|
@ -72,9 +72,8 @@ export class HaMoreInfoCoverTiltPosition extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
const forcedState = this.stateObj.state === "closed" ? "open" : undefined;
|
const openColor = stateColorCss(this.stateObj, "open");
|
||||||
|
const color = stateColorCss(this.stateObj);
|
||||||
const color = stateColorCss(this.stateObj, forcedState);
|
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<ha-control-slider
|
<ha-control-slider
|
||||||
@ -91,6 +90,8 @@ export class HaMoreInfoCoverTiltPosition extends LitElement {
|
|||||||
"current_tilt_position"
|
"current_tilt_position"
|
||||||
)}
|
)}
|
||||||
style=${styleMap({
|
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-color": color,
|
||||||
"--control-slider-background": color,
|
"--control-slider-background": color,
|
||||||
})}
|
})}
|
||||||
|
@ -64,14 +64,16 @@ class HuiCoverPositionTileFeature
|
|||||||
|
|
||||||
const value = Math.max(Math.round(percentage), 0);
|
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
|
const color = this.color
|
||||||
? computeCssColor(this.color)
|
? computeCssColor(this.color)
|
||||||
: stateColorCss(this.stateObj, forcedState);
|
: stateColorCss(this.stateObj);
|
||||||
|
|
||||||
const style = {
|
const style = {
|
||||||
"--color": color,
|
"--color": color,
|
||||||
|
// Use open color for inactive state to avoid grey slider that looks disabled
|
||||||
|
"--state-cover-inactive-color": openColor,
|
||||||
};
|
};
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
@ -64,14 +64,16 @@ class HuiCoverTiltPositionTileFeature
|
|||||||
|
|
||||||
const value = Math.max(Math.round(percentage), 0);
|
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
|
const color = this.color
|
||||||
? computeCssColor(this.color)
|
? computeCssColor(this.color)
|
||||||
: stateColorCss(this.stateObj, forcedState);
|
: stateColorCss(this.stateObj);
|
||||||
|
|
||||||
const style = {
|
const style = {
|
||||||
"--color": color,
|
"--color": color,
|
||||||
|
// Use open color for inactive state to avoid grey slider that looks disabled
|
||||||
|
"--state-cover-inactive-color": openColor,
|
||||||
};
|
};
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user