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

I can see that it is more compact when lines are removed and I like it that way as well when height is smaller.

This is OK; my point was about a vertical alignment.
A section w/o a divider line is still a section; in my example with 2 same entities card there is a misalignment between 2 section lines caused by a hidden ā€œdividerā€ element.
A possible way could be just making the divider transparent instead of removing it - this way keeps same height for a section.
Repeat, if you satisfied with your solution - itā€™s OK.

I have had a card to display alarm status (green = disarmed, red/blinking = armed) but it has stopped working. Maybe with an update.

alarm_control_panel.9000_aaa_zone_1_alarm get correct status update

Any idea what could be wrong?

type: vertical-stack
cards:
  - show_name: false
    show_icon: true
    type: button
    style: |
      ha-card {
        border-radius: 0px;
        {% if is_state('alarm_control_panel.9000_aaa_zone_1_alarm', 'disarmed') %} 
          animation: none;
          --state-alarm_control_panel-disarmed-color: green;
        {% elif is_state('alarm_control_panel.9000_aaa_zone_1_alarm', 'armed_night') %} 
          animation: blink 1s linear infinite;
          background-color: red;
          --state-alarm_control_panel-armed_night-color: white;
        {% elif is_state('alarm_control_panel.9000_aaa_zone_1_alarm', 'armed_away') %} 
          animation: blink 1s linear infinite;
          background-color: red;
          --state-alarm_control_panel-armed_away-color: white;
        {% else %}
          none
        {% endif %}
      }
      @keyframes blink {
        50% {opacity: 0;}
        }
    tap_action:
      action: none
    entity: alarm_control_panel.9000_aaa_zone_1_alarm
    icon: mdi:shield-home
    show_state: false
    hold_action:
      action: none

How do I change the font colour of the calendar events ?

type: custom:atomic-calendar-revive
view_layout:
  grid-area: Calendar
card_mod:
  style: |
    ha-card {
    border-style: none;
    color: red;
    font-size: 20px;
    background: transparent;            
    }  
name: null
enableModeChange: true
firstDayOfWeek: 1
maxDaysToShow: 300
maxEventCount: 5
refreshInterval: 60
showLocation: false
showMonth: true
showHiddenText: false
entities:
  - entity: calendar.ical_home

Consider reading release notes before updating card-mod.

I donā€™t have the calendar loaded, but try adding these to card mod and see if adjusts the calendar text colors

 --primary-text-color: green !important;
 --secondary-text-color: blue !important;  
type: custom:atomic-calendar-revive
view_layout:
  grid-area: Calendar
card_mod:
  style: |
    ha-card {
    border-style: none;
    color: red !important;
    font-size: 20px;
    background: transparent;  
    --primary-text-color: green !important;
    --secondary-text-color: blue !important;          
    }  
name: null
enableModeChange: true
firstDayOfWeek: 1
maxDaysToShow: 300
maxEventCount: 5
refreshInterval: 60
showLocation: false
showMonth: true
showHiddenText: false
entities:
  - entity: calendar.ical_home

Hello,

I admit that I updated without reading but I saw that there were some changes.
Now I really have difficulty reproducing the animations that you gave us at the startā€¦ Bumping, stretching, coloring icons etcā€¦

Can you please give us one updated example of animated icon ?

Thanks for helping
best regards

You should first start with fixing in accordance to changes described in release note for 3.4.
Now the ā€œstyleā€ option must be under ā€œcard_modā€ keyword like here:

card_mod:
  style: ...

As for examples for animations for button-card - check in the 2st post ā†’ link at the bottom, it has examples for animations. But if your code were working before the recent changes - you should start with the fix I told above.
You have just admitted that you have not read the release note - and probably you should read it now at last.

Thanks, Ill try it.

Can you (or someone) explain the ā€˜!importantā€™ at the end of lines?

Is it just so I pay attention to the change?

may be found.

2 Likes

Haā€¦you beat me to posting the same link :grinning:

2 Likes

Thanks for your repply.
Dont worry i read changelog before posting, but i was missing something.
I managed to fix it, thanks

ha slim animated

1 Like

Very good! So, a small mistake may cause some headache(

Itā€™s the very 1st link when googling ā€œimportant cssā€.
Also, this particular site is very good, as you know; I usually advise this site.

1 Like

Between a few CSS sites, your guides as well as Dimitriā€™s, I have learned a ton in a short time. :exploding_head:

Yes, I should have read change notesā€¦thanks for the lead and it is now working again :slight_smile:

Guess it is much better to give a tiny lead & let a man to solve the issue by himself )))

2 Likes

Hi all,

I donā€™t manage to make my ha-icon rotating on a markdown card.

the card-mod works like a charm on the card (ha-card) itself but nothing works with ha-icon or ha-svg-icon even with the ā€˜!importantā€™ flag.

Can someone help me ?

My code :

type: markdown
card_mod:
  style: |
    @keyframes rotation {
        0% {
          transform: rotate(0deg);
        }
        100% {
          transform: rotate(359deg);
        }
      }
    @keyframes colorize {
        0% {
          color: var(--primary-color);
        }
        50% {
          color: green;
        }
        100% {
          color: var(--primary-color);
        }
      }
    ha-card {
              color: var(--primary-color);
            }
    ha-icon {
              color: red;
              animation: rotation 10s linear infinite;
            }
    ha-svg-icon {
              color: green;
              animation: rotation 10s linear infinite;
            }
content: >-
  ## The card Title...and code

Page 5054

And now? This link is in the first post of this topic as well and hundrets of posts are refering to this first post and this link.