mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-20 14:49:27 +00:00
Compare commits
2 Commits
20240103.0
...
background
Author | SHA1 | Date | |
---|---|---|---|
![]() |
536fe6a23c | ||
![]() |
d8ddbefcf6 |
@@ -1070,7 +1070,7 @@ class HUIRoot extends LitElement {
|
|||||||
var(--header-height) + 48px + env(safe-area-inset-top)
|
var(--header-height) + 48px + env(safe-area-inset-top)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
#view > * {
|
hui-view {
|
||||||
/**
|
/**
|
||||||
* The view could get larger than the window in Firefox
|
* The view could get larger than the window in Firefox
|
||||||
* to prevent that we set the max-width to 100%
|
* to prevent that we set the max-width to 100%
|
||||||
@@ -1082,7 +1082,6 @@ class HUIRoot extends LitElement {
|
|||||||
flex: 1 1 100%;
|
flex: 1 1 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
padding-bottom: env(safe-area-inset-bottom);
|
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
.hide-tab {
|
.hide-tab {
|
||||||
|
@@ -298,8 +298,7 @@ export class MasonryView extends LitElement implements LovelaceViewElement {
|
|||||||
:host {
|
:host {
|
||||||
display: block;
|
display: block;
|
||||||
padding-top: 4px;
|
padding-top: 4px;
|
||||||
height: 100%;
|
padding-bottom: env(safe-area-inset-bottom);
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.badges {
|
.badges {
|
||||||
|
@@ -196,8 +196,7 @@ export class SideBarView extends LitElement implements LovelaceViewElement {
|
|||||||
:host {
|
:host {
|
||||||
display: block;
|
display: block;
|
||||||
padding-top: 4px;
|
padding-top: 4px;
|
||||||
height: 100%;
|
padding-bottom: env(safe-area-inset-bottom);
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
|
@@ -104,6 +104,41 @@ export class HUIView extends ReactiveElement {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public connectedCallback() {
|
||||||
|
super.connectedCallback();
|
||||||
|
this._applyBackgroundTheme();
|
||||||
|
}
|
||||||
|
|
||||||
|
private _applyBackgroundTheme() {
|
||||||
|
if (this._viewConfigTheme) {
|
||||||
|
const theme = this.hass.themes?.themes[this._viewConfigTheme];
|
||||||
|
if (!theme) {
|
||||||
|
this.parentElement?.style.removeProperty("--lovelace-background");
|
||||||
|
this.parentElement?.style.removeProperty("--primary-background-color");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (theme["lovelace-background"]) {
|
||||||
|
this.parentElement?.style.setProperty(
|
||||||
|
"--lovelace-background",
|
||||||
|
theme["lovelace-background"]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.parentElement?.style.removeProperty("--lovelace-background");
|
||||||
|
}
|
||||||
|
if (theme["primary-background-color"]) {
|
||||||
|
this.parentElement?.style.setProperty(
|
||||||
|
"--primary-background-color",
|
||||||
|
theme["primary-background-color"]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.parentElement?.style.removeProperty("--primary-background-color");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.parentElement?.style.removeProperty("--lovelace-background");
|
||||||
|
this.parentElement?.style.removeProperty("--primary-background-color");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public willUpdate(changedProperties: PropertyValues): void {
|
public willUpdate(changedProperties: PropertyValues): void {
|
||||||
super.willUpdate(changedProperties);
|
super.willUpdate(changedProperties);
|
||||||
|
|
||||||
@@ -166,6 +201,7 @@ export class HUIView extends ReactiveElement {
|
|||||||
this.hass.selectedTheme !== oldHass.selectedTheme
|
this.hass.selectedTheme !== oldHass.selectedTheme
|
||||||
) {
|
) {
|
||||||
applyThemesOnElement(this, this.hass.themes, this._viewConfigTheme);
|
applyThemesOnElement(this, this.hass.themes, this._viewConfigTheme);
|
||||||
|
this._applyBackgroundTheme();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (changedProperties.has("narrow")) {
|
if (changedProperties.has("narrow")) {
|
||||||
@@ -225,6 +261,8 @@ export class HUIView extends ReactiveElement {
|
|||||||
applyThemesOnElement(this, this.hass.themes, viewConfig.theme);
|
applyThemesOnElement(this, this.hass.themes, viewConfig.theme);
|
||||||
this._viewConfigTheme = viewConfig.theme;
|
this._viewConfigTheme = viewConfig.theme;
|
||||||
|
|
||||||
|
this._applyBackgroundTheme();
|
||||||
|
|
||||||
if (addLayoutElement) {
|
if (addLayoutElement) {
|
||||||
while (this.lastChild) {
|
while (this.lastChild) {
|
||||||
this.removeChild(this.lastChild);
|
this.removeChild(this.lastChild);
|
||||||
|
Reference in New Issue
Block a user