🔹 Card-mod - Add css styles to any lovelace card

Would this work on the card, substituting the desired value:

    ha-card {
      margin-bottom: -4px;
    }

Note the difference in spacing between the light card and cover card compared to the cover card and the next card.

I had similar prob…
I could fix it with row height:

grid_options:
  columns: 12
  rows: 0,5

Ya can try to play with this…on your desired columns and row height…
In the layout options…
Hope this helps you too…

Card-mod duplicate patch warning

I received a notification re Card-mod duplicate patch warning as follows:

I’ve read through the link provided but I am uncertain about what to do.

Looking at the resources page I see this entry:

/hacsfiles/lovelace-card-mod/card-mod.js?hacstag=190927524420

I gather I am asked to create a configuration.yaml entry like this:

frontend:
  extra_module_url:
    - /hacsfiles/lovelace-card-mod/card-mod.js?hacstag=190927524420

I noticed I already have this in my configuration.yaml

  extra_module_url:
    - /local/community/lovelace-card-mod/card-mod.js

Should I replace my earlier entry with the one with the hash code? Or do I use both?

Also if I place the one with the hash code in configuration.yaml, do I delete it from the resource list?

Thanks for any advice.

This is the issue and you need to replace with the Dashboard resource URL /hacsfiles/lovelace-card-mod/card-mod.js?hacstag=190927524420 then reboot Home Assistant.

If you don’t use CAST, yes you can remove Dashboard resource URL, but if you use HACS it will return next time you upgrade. So the recommend approach is to keep both, and update extra_module_url when you update card-mod.

1 Like

Does the hacstag change with each revision to card_mod, requiring configuration.yaml to be updated too?

Yes. hacstag changes on each update. For single digit revisions it is the last 4 digits of the hashtag. The first 9 is the GitHub repo ID for card-mod.

Confirming configuration.yaml needs updating on each revision as is noted in the release notes.

Thanks, I don’t know what CAST is, so I guess I just update the configuration.yaml entry and leave the rest alone.

Thanks for your help.

CAST is catsing to Google Cast device.

1 Like

Is there no way to make that change automatically as part of the update?

Actually, now I think about it, I’m not sure I want HACS being able to modify configuration.yaml.

HACS does not support this, and as you say, I don’t think it should.

If card-mod was an integreation it could manage all this, like Browser Mod does. However as card-mod is just a Frontend resource, it can’t do much on this regard.

A rather light and quite reliable card-mod of Thomas Loven became THIS - heavy, overloaded, full of unwanted stuff.
4.x versions are not what it should be.

Disagree. Do not see any big changes and overloads, but more options. And I like options. And if this is pointed to Darryn from your side, already Thomas introduced the option anch change to style non ha-card items in one of his pulled releases.

To be honest, where do you see any heavy, overloaded, full of unwanted stuf. If you don’t want to style option pages or the extended themes capabilities, you are not forced to use them and just run everything as before. I didn’t have to change one single line since Darryn took over. But added just more styles, which were not possible before.

1 Like

Agreed.

What I welcome is styling elements inside conditional cards/rows, styling buttons in button-row “per-button” (not from above as it is in 3.x).
Honestly, not using myself strategies & have no desire to style a particular button on some system toolbar - this was already possible before - perhaps not everything but I do not recall here complains. Yes, we could not access system pages like “dev tools” in themes - this was possible in JS only.

Many added stuff needs more resources. I see a loss of performance on old mobile devices (iPad Air with iOS 15.x, for example). With 3.4.6 it works smooth.
Well, regarding “unwanted” - agree, this is subjective. For sure, there is some amount of users who wants to style “strategies”, for instance.

There were breaking changes.
Some of them like “declaring classes for :host in themes” were specified in Release notes. Since this is about themes - there were no many changes users needed to do after upgrade to 4.x.
Another breaking changes like “mod-card stopped being transparent” were even not considered by him as a breaking change - I spend some time here to convince him to agree with that. Note that he actually never agreed with me that this was wrong - he just made a new release with a fix with remark like “for users who do not like the previous change”. If he was not forced to revert these changes - then users would have to fix it manually in their setups. Plenty of needed extra code.
Also, almost forgot - the breaking change for accessing “$ in ha-card” - not a big deal, can be fixed locally by users - but was not announced.

Why now? Because of that extra_module_url related error)). How we managed to live before it? Again, these advices about “use only one registration - in extra_module_url if you do not use cast” appeared only after another “interrogation” here(((.

Btw, kudos to Darryn who patiently explains users in Github how to deal with that “extra_module_url” notification. Lot of efforts, could it be simpler?

Yes. But all this has been improved and is now stable an known. Now only discuss again, what has been the case brings benefit for what? Is hav been changes as wanted. Even with some design decisions before.

Compare this to all the ideas of the core developers, who don’t care about complains and wishes, now, before and more and more. In this case, here after some valuable feedback, it has been fixed. Great. Now only being angry, that only there was no “sorry” bevor fixing? For me a little bit over.

And here you are wrong for me. Not now. This is was bevor as well. Do you remember the problems, where card_mod was removed from HA in some cards after opening in editor (after again changes in core), here in maps cards, etc? I remember, you had the problem as well. And this was the point in time, where he figured out, that this was caused or at least supported by not joining both resources, that one from config (already added and recommended by Thomas) and the one from hacs. Month ago. In old release. Found and recommended to fix this kind of browser problems. Helpful and not new. Without this recommendation, my map card would loose the card mod still till today on every edit.

1 Like

I tend to agree with arganto here - from my perspective Darryn’s work has been about both addressing long-term issues that card_mod had - just look at the number of bug reports that have been resolved - and also responding to quite radical changes in core frontend as it moves away from deprecated web components.

It maybe true that earlier versions still work - I’m not sure I’d like to try them now. I was stuck on 3.30 for ages because later releases were unworkable on my system. That impasse was only resolved once Darryn got involved, and I appreciate it very much.

I understand you, but imho these are a bit different things.
The problem with core & frontend devs is that they tend more & more ignore user’s opinion - the do what they want mostly, they trust own “user surveys” etc. Particularly for the frontend, even from a not-NC developer point of view, some PRs are disapproved not because they do not fit to plans or their understanding of users’ needs - but also because “we do not want to make it for 3rd party” (like exposing entity_id for more-info to allow customizing it by custom plugins).
Regarding card-mod, things are different. Yes, the developer listens to user’s requests (not to mention about helping users a lot - in fact, now he is the only person who communicates with users in the repo). But the plugin got many additional functions which (I suspect) made it too heavy. My suspections are based on tests with old devices - as I said, they work a bit faster with old 3.x. If anything can be improved in this part - would be great.

Of course I remember, this ticket in repo was registered by me. The only thing that this glitch occurred even w/o “extra_module_url” (that was reported by me on github in that ticket). So I doubt that this glitch was caused by this line. If this glitch gone - fine, but I am not 100% sure that the “add hacstags into extra_module_url” is the cure.
Update: as you know, I tested card-mod a lot. Not for myself, but for supporting users. And there was a large practice with “open editor, type in card-mod code, …” - and during these same repeated again & again actions I erratically saw these glitches - and (as I said) even w/o that line in config. Sometimes the glitch occurred.

Here ist was 100%. I had the problem, with different urls from hacs and config (and had it in config for ages because Thomas recommended) and all was gone since I use the same url.

Many things changed between the glitch was observed 1st time & you added the hacstag. The fact that you stopped seeing the glitch - does not mean that the glitch was because of absence of hacstags. As I said above - erratically it occurred even w/o that line in config.
Anyway, great that you got it solved))

BTW,

let me remind how many my neurons I wasted here while explaining/convincing.

Hi card-modders. I created a new post to discuss 4.2.0 - Duplicate patch warning so we can move discussion about this specific topic to that thread. Thank you.

In the post I include timeline on the underlying issue and why duplicate patching needs to be detected and configs resolved.

2 Likes

Hi,
this mod doesn’t seem to be working anymore.
It doesn’t hide the name, nor makes the select bar longer…

HA 2026.2.1 / card-mod v4.2.0