Fix map icon color (#19567)

* Fix map icon color

* different solution

* updates from code review
This commit is contained in:
karwosts 2024-01-30 17:57:35 -05:00 committed by GitHub
parent 28c21b1041
commit e45709fffc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 6 deletions

View File

@ -133,7 +133,7 @@ export class HaLocationsEditor extends LitElement {
.layers=${this._getLayers(this._circles, this._locationMarkers)} .layers=${this._getLayers(this._circles, this._locationMarkers)}
.zoom=${this.zoom} .zoom=${this.zoom}
.autoFit=${this.autoFit} .autoFit=${this.autoFit}
.darkMode=${this.darkMode} ?darkMode=${this.darkMode}
></ha-map> ></ha-map>
${this.helper ${this.helper
? html`<ha-input-helper-text>${this.helper}</ha-input-helper-text>` ? html`<ha-input-helper-text>${this.helper}</ha-input-helper-text>`

View File

@ -156,9 +156,9 @@ export class HaMap extends ReactiveElement {
} }
private _updateMapStyle(): void { private _updateMapStyle(): void {
const darkMode = this.darkMode ?? this.hass.themes.darkMode ?? false; const darkMode = this.darkMode || (this.hass.themes.darkMode ?? false);
const forcedDark = this.darkMode ?? false; const forcedDark = this.darkMode;
const map = this.shadowRoot!.getElementById("map"); const map = this.renderRoot.querySelector("#map");
map!.classList.toggle("dark", darkMode); map!.classList.toggle("dark", darkMode);
map!.classList.toggle("forced-dark", forcedDark); map!.classList.toggle("forced-dark", forcedDark);
} }
@ -361,7 +361,7 @@ export class HaMap extends ReactiveElement {
); );
const className = const className =
this.darkMode ?? this.hass.themes.darkMode ? "dark" : "light"; this.darkMode || this.hass.themes.darkMode ? "dark" : "light";
for (const entity of this.entities) { for (const entity of this.entities) {
const stateObj = hass.states[getEntityId(entity)]; const stateObj = hass.states[getEntityId(entity)];

View File

@ -166,7 +166,7 @@ class HuiMapCard extends LitElement implements LovelaceCard {
.paths=${this._getHistoryPaths(this._config, this._stateHistory)} .paths=${this._getHistoryPaths(this._config, this._stateHistory)}
.autoFit=${this._config.auto_fit || false} .autoFit=${this._config.auto_fit || false}
.fitZones=${this._config.fit_zones} .fitZones=${this._config.fit_zones}
.darkMode=${this._config.dark_mode} ?darkMode=${this._config.dark_mode}
interactiveZones interactiveZones
renderPassive renderPassive
></ha-map> ></ha-map>