nathan-gs / ha-map-card

A Map Card for Home Assistant
https://community.home-assistant.io/t/map-card-a-slightly-improved-map-card/693088
MIT License
30 stars 9 forks source link

[FR] Advanced formatting for a marker #40

Closed ildar170975 closed 4 months ago

ildar170975 commented 4 months ago

Here is a default look for a person entity:

изображение

Note that a marker has a circle shape (caused by box-radius: 50%). But what if I need to show a phone? Does not look nice:

изображение

So, 1st idea - allow to customize box-radius. Assume we got rid of that circle shape by CSS:

изображение

And now we do not like a background of the marker - so we are using a PNG image with a transparent background. But it anyway does not look cool - because of an own marker's background. This can be fixed by CSS as well:

изображение

Finally, we can remove a border:

изображение

Suggestion: Add a NEW option - style_marker. This option can be defined as a dictionary:

style_marker:
  xxx: xxx
  xxx: xxx
  xxx: xxx

where "xxx: xxx" - CSS styles which should be set directly to a marker. Imho we should allow a user to define ANY set of styles here - they are just passed to a marker "as is".

By default this option style_marker is optional. It should be defined both per-card & per-entity:

type: custom:map-card
entities:
  - entity: ...
    style_marker:
      ...
  - entity: ...
  - entity: ...
    style_marker:
      ...
style_marker:
  ...

If defined per-card - then the style_marker option is for all markers, unless it is overridden by a style_marker option for a particular marker.

ildar170975 commented 4 months ago

Seems I missed LOT of things. There is a new css option which hopefully allows to do similar things...