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

Okay I got it. Itā€™s from:

:host .entity {
   display: flex;
   flex-direction: column-reverse
}

Anyway I would like to ask You about one thing. I want to animate icon in entity-multiple-row but I canā€™t get it via CSS. Is it possible to animate window icon while open?
image
Normally for main entity I can use:

:host .icon-small {
   color: orange;
}

But for multiple-entity itā€™s not working.

You should write a code accordingly to a real DOM structure. Open Code Inspector and build a path to the required element. Do not try to use a code without understanding.
Surely you may use ready examples (1st post, see a link at the bottom), but these examples give you a direction and may not cover all your cases.

Because you have no animation specified!!!

Happy new year, dear Marius!

1 Like

but blink is native? I never specify that and it always worksā€¦maybe only for Button.

      @keyframes blink {
        100% {opacity: 0;}
      }

and blinking away :wink:

Dec-31-2021 18-32-11

Thank you!!

с Š½Š¾Š²Ń‹Š¼ Š³Š¾Š“Š¾Š¼

1 Like

Having another issue I canā€™t figure outā€¦

Using multple-entity-row, I have one card which removes padding between the entities, which works great. I have another multiple-entity-card which uses a style to align the left icon more to the left, which also works great. However, I canā€™t seem to combine them.

This is the code from both individual cards:

                - entity: input_boolean.motion_light_garden
                  icon: mdi:nature-people
                  [...]
                  style: |
                    :host .entities-row .entity {
                      margin-right: 10px;
                    }
                - entity: input_boolean.motion_light_toilet
                  icon: mdi:paper-roll
                  [...]
                  card_mod:
                    style:
                      hui-generic-entity-row: 
                        $: |
                          state-badge {
                            flex: 0 0 0px !important;
                            height: 35px;
                            line-height: 35px;
                          }

Sure, but itā€™s still very much a work in progress. This is how it looks now:

The code is here: kiosk_mode: user_settings: - users: - Samsung Galaxy S4 - Pastebin.com. To get it working youā€™ll need to install the custom cards and images for the Neon theme, which can be found here: Neon Lovelace UI & Theme for tablets

1 Like

It was just example. I have already tried several DOM structures.
It looks like this:
hui-generic-entity-row > entities-row > entity > div > state-badge .icon-small > ha-state-icon > ha-icon > ha-svg-icon

Tried several configuration but itā€™s not quite obvious I think. Iā€™m a programmer and I normally I donā€™t have a problems to work with structures but I feel like in the dead end :smiley: Feel stupid
Would You mind check it if it should working?

@Milenco
@shade.pl
I will be back in a few days and will try to help you!

1 Like

Thanks in advance! Happy new year!

2 Likes
        {% if states('sensor.date') == '2021-12-31' and
           states('sensor.time') > '23:58' %}animation: blink 2s ease infinite;
        {% endif %}

I know the time shouldnā€™t be dealt with like thisā€¦ but hey, it works for nowā€¦

maybe:

now() > now().replace(hour=23).replace(minute=59).replace(second=30)

is better, but the frontend doesnā€™t update without a refreshā€¦

will try this next year:

{% if now().day == 31 and now().month == 12 and
           now() > today_at('23:59') %}

Has anyone made the switch described in the recent update:

frontend:
  extra_module_url:
    - /local/card-mod.js

If I do this and remove it from being a Lovelace resource I get an error in HACS that card-mod hasnā€™t been loaded after restarting. Are we supposed to have it in both places? (I did change the path to be correctā€¦)

using an empty entities card, to get a header in a vertical stack:

  - type: entities
    title: Set Switches
    card_mod:
      style: |
       .card-header {
          background-color: var(--background-color-off);
          color: var(--text-color-off);
          padding-top: 0px;
          padding-bottom: 0px;
          margin: 0px 0px -8px 0px;
        }
    entities: []

can we somehow add an action to it and navigate to another view?

I think you still need both. But this gives a console error about card-mod already being loaded

You might need to clear your cache ā€” always a good practice when it comes to any frontend oddities.

I have card-mod only loaded under the frontend section now (i.e. itā€™s not under my resources section anymore, which is how I understand the docs).

Rather than just saying you ā€œfixedā€ your path, show it. In my case, it looks like this (installed via HACS):

frontend:
  ...
  extra_module_url:
    ...
    - /hacsfiles/lovelace-card-mod/card-mod.js

If you donā€™t have it in resources as well you will see this:


Even after you clear cache

Also this:

Thatā€™s interestingā€¦ I donā€™t have that error.

Iā€™m using UI mode for Lovelace. Maybe thatā€™s why. It doesnā€™t hurt loading it via the resources and yaml. Just a console error for it.

1 Like

Did You resolve this issue @Mariusthvdb ?

Thank You @Milenco - Got one question. How did You put entities data in the secondary_info? I canā€™t find it here in example so Iā€™m assuming itā€™s another addon?

exactly what would you like to see resolved? custom-ui is ā€˜strongerā€™ than card-mod, so I have resolved it by understanding the inner workings and playing with that.

the non centric icon is another matter, and still happening. Think those are simply not 100% prefect icons :wink:

Hi, thank You for the response. I was playing with that icon centre and finally fixed with:

state-badge.pointer {
   animation: rotation .5s linear infinite;
   line-height: 39px;
}