aukedejong / lovelace-windrose-card

Home Assistant Lovelace Windrose Card
60 stars 2 forks source link

[Feature request] card using a background image #32

Closed carryonrewardless closed 7 months ago

carryonrewardless commented 1 year ago

This great card could be enhanced by enabling the selection of an image as a background to the windrose display. An example would be to have the windrose overlay an image of the house (plan view) at the location. Cheers

aukedejong commented 1 year ago

A made the windrose transparent before, for someone who added to card to an picture elements card, if I remember correctly. Maybe you can use that card.

And with card_mod you can set CSS styles. A background-image css?

I don't have much time to work on new features, the coming weeks.

ildar170975 commented 1 year ago

Surely may be added by card-mod (background-image); need to use a png image with a transparent bottom part (where a scale is displayed).

olivierouellet commented 1 year ago

The other issue was #12 . The proposed solution was to add this to the card configuration (although I've never used it myself) :

card_mod:
  style: |
    ha-card {
      background-color: transparent
    }
carryonrewardless commented 1 year ago

I have this in my card config but get no background image. The path to the image file is valid.

card_mod:
  style: |
    ha-card {
      background-color: transparent;
      background: url('/local/images/DSC_0718.png');
    }

Tried also with background-image and also without the semi-colons.

carryonrewardless commented 12 months ago

Ok my bad. I had created a /local folder instead of putting it into /www. Now its working fine. Had to select rose lines colours as transparency and opacity parameters were not doing anything. image

colors:
  rose_lines: rgb(0,255,0)
  rose_direction_letters: yellow
  rose_percentages: blue
card_mod:
  style: |
    ha-card {
      background-image: url('/local/images/Floorplan.png');
      background-size: 98%;
      background-opacity: 0.2;
    }

Can the rose percentages font size or bolding be selected?

ildar170975 commented 12 months ago

need to use a png image with a transparent bottom part (where a scale is displayed).

as it was said earlier.

aukedejong commented 12 months ago

The windbar is also drawn on a canvas, so the text can't be styled with CSS. I'm working on an option to hide the windbar. You can also use Ildars option and make the background higher, so the windbar is drawn under the floor plan.

ildar170975 commented 12 months ago

@aukedejong Just some thoughts: can we use TWO canvas elements placed one after one inside an upper container? image Then hiding the scale may be achieved by not showing the 2nd canvas. Also, the background image may be selected to the "rose" canvas then: image

And please provide one more option - kind of a padding between 2 canvases.

aukedejong commented 12 months ago

That's not the plan. Maybe in the future. It's a bigger change then the one I'm working on now.

Currently the new hide option doesn't draw the windbar.

Also good for performance for lower end devices.

carryonrewardless commented 12 months ago

I created a new image file with 100% transparency at the bottom using LibreOffice Draw. The bottom section was by inserting an additional rectangle area. The main image area was set to 10% transparency but this did not seem to do much. Here is the result. image

ildar170975 commented 12 months ago

My remark is not about the implementation - - it is about using an image in general. I think the best way is showing a map:

image

Here is an example for a country house; in case of a city building - same, a map with this building.

card_mod:
  style: |
    canvas {
      background-image: url('/local/images/test/country-plot.png') !important;
      background-size: 100% 100%;
    }
aukedejong commented 7 months ago

I think this one can be closed. It's possible with card_mod to use a background image.

ildar170975 commented 7 months ago

@aukedejong I hope anyway one day the "windrose" part will have it's one canvas element - to set an image with not touching the "scale" part.