šŸ”¹ Card-mod - Add css styles to any lovelace card

A useless animation example:
sss
Starring:

  • entities card
  • dummy-entity-card
  • card-mod
type: vertical-stack
title: testing
cards:
  - type: entities
    entities:
      - type: 'custom:dummy-entity-row'
        entity: sun.sun
        icon: 'mdi:web'
        name: ' '
        style:
          state-badge:
            $:
              ha-icon:
                $: |
                  ha-svg-icon {
                    color: red;
                    animation: move 3s linear alternate infinite;
                  }
                  @keyframes move {
                    0% {
                     left: 0px;
                    }
                    100% {
                      left: 408px;
                    }
                  }
    style: |
      ha-card {
        animation: wobble 3s linear alternate infinite;
      }
      @keyframes wobble {
        0% {
         -webkit-transform: rotate(-5deg);
          transform: rotate(-5deg);
        }
        100% {
          -webkit-transform: rotate(5deg);
          transform: rotate(5deg);
        }
      }
2 Likes

Let me start off by appologising as im sure this is simple however canā€™t find a solution.

Just wanting to be able to edit font size but canā€™t get the right element.

Am trying to target the txt ā€œSat 14.53ā€

Try using this (ā€œChanging a font-sizeā€ part):

1 Like

Regarding styling badges.

  1. Tried to summarize everything in these posts:
    Badges: different styling
    Badges: conditional show/hide
    Badges: hidden name

  2. Cannot find out how to change a font-size for the name:
    ŠøŠ·Š¾Š±Ń€Š°Š¶ŠµŠ½ŠøŠµ

      - entity: sensor.cleargrass_1_co2
        name: name font (very very long name)
        style:
          ha-state-label-badge:
            $:
              ha-label-badge:
                $: |
                  .badge-container .title {
                    color: orange;
                    font-size: 8px !important;
                  }

Any advice will be welcome.

Another ā€œmonster threadā€. Simple question, might be harder answer, hope notā€¦

I want to ā€œscaleā€ a large picture that is not fitting on a screen and does not scale properly in a picture entity card. Is there any example code I can (re)use?

Thanks

Not wanting to try and find an answer first yourself is one thing, but wanting the community to figure out what you want is a bit much to ask I fear.

If youā€™d start giving us a clue and maybe even some first attempts of a config, that might increase your chances at getting some help hereā€¦

1 Like

Ehmā€¦ I would like to have a picture entity card with a large floorplan that currently does not fit in a browser windows in full panel mode. I want to know how I can scale such an image. It that clear enough :)?

Edit: this was not meant to be snarky

No because you are asking people to write a card for you from scratch while making no effort yourself and not showing what you have tried or any screenshots no showing your problem. Is that clear enough for you? (Being snarky with people trying to help you wonā€™t end well)

Wow, that is not meant to be so.

I have tried so much, I donā€™t even know what to show. I really do not know another way of asking what I would like to achieve.

From another angleā€¦

I have a large floorplan picture in /local. It shows in my picture entity elements card which I have created in my lovelace view in panel mode. The problem I am facing is that this picture scales out of the screen, it is too bigā€¦ so my question is how is can ā€œscaleā€ down that image to for example 50% of the screen or 80% or fit to the window or whatever is possible.

Since I have really tried so much and in the end I only found 1 solution in the forum panels from someone that has put a lot of space around the plan to make the picture actually fit. I did that and that works, but it does not properly display on a mobile or scales when using on another resolution screen.

So sorry if I am asking the question in a wrong way, but I would like to know what the correct way to do this since I can not find any source, code, solution, whatever that solves my problem.

Have you checked šŸ”¹ Layout-card - Take control of where your cards end up ?

Yes I have. But I think due to fact I want to use panel mode I have no issue with card placement, it is just 1 card which is full panel but the (picture in the) panel is too big :slight_smile:

If you read the docs, you can create a card that takes full space without using panel modeā€¦ā€¦

Yes but can I use a lovelace Picture Elements Card Configuration in that?

so post that config here, and allow the community to help you.

Clearly you havenā€™t even checked the examples thereā€¦
Answer: yes you can.

So what is the intended behavior? What is currently happening?

I thought I was following the doc but I must have something wrong. I am trying to modify a couple of CSS variables.

Here is my config:


              - type: light
                hold_action:
                  action: none
                entity: light.master_bedroom_light
                name: Master Bedroom
                card_mod:
                  style: |
                    ha-card {
                      --font-size: 1.7rem;
                      }

If Iā€™m reading the inspector right, it appears as thought the card mod is being applied to the ha-card but in the wrong place.

Is anybody able to see what Iā€™m doing wrong?

Change that to --name-font-size: 1.7rem !important;.

I posted the picture:
ŠøŠ·Š¾Š±Ń€Š°Š¶ŠµŠ½ŠøŠµ
The font is changed but the text is not centrally aligned.

Spot on, thank you so much. Have just learnt so much from your post that you linked.