mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 09:16:38 +00:00
Move lovelace background settings to theme (#3561)
* Move lovelace background settings to theme While being backwards compatible * Also update cast
This commit is contained in:
parent
b37a0e2d43
commit
753e069323
@ -57,10 +57,16 @@ class HcLovelace extends LitElement {
|
||||
const index = this._viewIndex;
|
||||
|
||||
if (index !== undefined) {
|
||||
this.shadowRoot!.querySelector("hui-view")!.style.background =
|
||||
const configBackground =
|
||||
this.lovelaceConfig.views[index].background ||
|
||||
this.lovelaceConfig.background ||
|
||||
"";
|
||||
this.lovelaceConfig.background;
|
||||
|
||||
if (configBackground) {
|
||||
this.shadowRoot!.querySelector("hui-view")!.style.setProperty(
|
||||
"--lovelace-background",
|
||||
configBackground
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -568,7 +568,12 @@ class HUIRoot extends LitElement {
|
||||
unusedEntities.hass = this.hass!;
|
||||
}
|
||||
);
|
||||
root.style.background = this.config.background || "";
|
||||
if (this.config.background) {
|
||||
unusedEntities.style.setProperty(
|
||||
"--lovelace-background",
|
||||
this.config.background
|
||||
);
|
||||
}
|
||||
root.append(unusedEntities);
|
||||
return;
|
||||
}
|
||||
@ -597,8 +602,13 @@ class HUIRoot extends LitElement {
|
||||
}
|
||||
|
||||
view.hass = this.hass;
|
||||
root.style.background =
|
||||
viewConfig.background || this.config.background || "";
|
||||
|
||||
const configBackground = viewConfig.background || this.config.background;
|
||||
|
||||
if (configBackground) {
|
||||
view.style.setProperty("--lovelace-background", configBackground);
|
||||
}
|
||||
|
||||
root.append(view);
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,9 @@ export class HuiUnusedEntities extends LitElement {
|
||||
private renderStyle(): TemplateResult {
|
||||
return html`
|
||||
<style>
|
||||
:host {
|
||||
background: var(--lovelace-background);
|
||||
}
|
||||
#root {
|
||||
padding: 4px;
|
||||
display: flex;
|
||||
|
@ -121,6 +121,7 @@ export class HUIView extends LitElement {
|
||||
padding: 4px 4px 0;
|
||||
transform: translateZ(0);
|
||||
position: relative;
|
||||
background: var(--lovelace-background);
|
||||
}
|
||||
|
||||
#badges {
|
||||
|
Loading…
x
Reference in New Issue
Block a user