mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 10:16:46 +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;
|
const index = this._viewIndex;
|
||||||
|
|
||||||
if (index !== undefined) {
|
if (index !== undefined) {
|
||||||
this.shadowRoot!.querySelector("hui-view")!.style.background =
|
const configBackground =
|
||||||
this.lovelaceConfig.views[index].background ||
|
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!;
|
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);
|
root.append(unusedEntities);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -597,8 +602,13 @@ class HUIRoot extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
view.hass = this.hass;
|
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);
|
root.append(view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,9 @@ export class HuiUnusedEntities extends LitElement {
|
|||||||
private renderStyle(): TemplateResult {
|
private renderStyle(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
<style>
|
<style>
|
||||||
|
:host {
|
||||||
|
background: var(--lovelace-background);
|
||||||
|
}
|
||||||
#root {
|
#root {
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -121,6 +121,7 @@ export class HUIView extends LitElement {
|
|||||||
padding: 4px 4px 0;
|
padding: 4px 4px 0;
|
||||||
transform: translateZ(0);
|
transform: translateZ(0);
|
||||||
position: relative;
|
position: relative;
|
||||||
|
background: var(--lovelace-background);
|
||||||
}
|
}
|
||||||
|
|
||||||
#badges {
|
#badges {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user