Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/panels/lovelace/cards/hui-map-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,27 @@ class HuiMapCard extends LitElement implements LovelaceCard {
continue;
}

// create icon
let iconHTML = "";
const iconColor =
this._config!.dark_mode === true ? "#FFFFFF" : "#000000";
if (icon) {
const el = document.createElement("ha-icon");
el.setAttribute("icon", icon);
el.style.color = iconColor;
iconHTML = el.outerHTML;
} else {
const el = document.createElement("span");
el.innerHTML = title;
el.style.color = iconColor;
iconHTML = el.outerHTML;
}

// create marker with the icon
mapItems.push(
Leaflet.marker([latitude, longitude], {
icon: Leaflet.divIcon({
html: icon ? `<ha-icon icon="${icon}"></ha-icon>` : title,
html: iconHTML,
iconSize: [24, 24],
className: "",
Comment thread
springstan marked this conversation as resolved.
Outdated
}),
Expand Down
8 changes: 6 additions & 2 deletions src/panels/map/ha-panel-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,13 @@ class HaPanelMap extends LocalizeMixin(PolymerElement) {
if (entity.attributes.icon) {
const el = document.createElement("ha-icon");
el.setAttribute("icon", entity.attributes.icon);
el.style.color = "#000000";
iconHTML = el.outerHTML;
} else {
iconHTML = title;
const el = document.createElement("span");
el.innerHTML = title;
el.style.color = "#000000";
iconHTML = el.outerHTML;
}

icon = this.Leaflet.divIcon({
Expand All @@ -129,7 +133,7 @@ class HaPanelMap extends LocalizeMixin(PolymerElement) {
className: "",
Comment thread
springstan marked this conversation as resolved.
Outdated
});

// create market with the icon
// create marker with the icon
mapItems.push(
this.Leaflet.marker(
[entity.attributes.latitude, entity.attributes.longitude],
Expand Down