mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-22 00:36:34 +00:00
Restore map filter theme (#18667)
This commit is contained in:
parent
244340f211
commit
f3f63d95b5
@ -151,8 +151,14 @@ export class HaMap extends ReactiveElement {
|
|||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const darkMode = this.darkMode ?? this.hass.themes?.darkMode;
|
this._updateMapStyle();
|
||||||
this.shadowRoot!.getElementById("map")!.classList.toggle("dark", darkMode);
|
}
|
||||||
|
|
||||||
|
private _updateMapStyle(): void {
|
||||||
|
const darkMode = this.darkMode ?? this.hass.themes.darkMode;
|
||||||
|
const map = this.shadowRoot!.getElementById("map");
|
||||||
|
map!.classList.toggle("dark", darkMode);
|
||||||
|
map!.classList.toggle("forced-dark", this.darkMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _loadMap(): Promise<void> {
|
private async _loadMap(): Promise<void> {
|
||||||
@ -162,9 +168,8 @@ export class HaMap extends ReactiveElement {
|
|||||||
map.id = "map";
|
map.id = "map";
|
||||||
this.shadowRoot!.append(map);
|
this.shadowRoot!.append(map);
|
||||||
}
|
}
|
||||||
const darkMode = this.darkMode ?? this.hass.themes.darkMode;
|
|
||||||
[this.leafletMap, this.Leaflet] = await setupLeafletMap(map);
|
[this.leafletMap, this.Leaflet] = await setupLeafletMap(map);
|
||||||
this.shadowRoot!.getElementById("map")!.classList.toggle("dark", darkMode);
|
this._updateMapStyle();
|
||||||
this._loaded = true;
|
this._loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,7 +501,10 @@ export class HaMap extends ReactiveElement {
|
|||||||
}
|
}
|
||||||
#map.dark {
|
#map.dark {
|
||||||
background: #090909;
|
background: #090909;
|
||||||
--map-filter: invert(0.9) hue-rotate(170deg) grayscale(0.7);
|
}
|
||||||
|
#map.forced-dark {
|
||||||
|
--map-filter: invert(0.9) hue-rotate(170deg) brightness(1.5)
|
||||||
|
contrast(1.2) saturate(0.3);
|
||||||
}
|
}
|
||||||
#map:active {
|
#map:active {
|
||||||
cursor: grabbing;
|
cursor: grabbing;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user