Here a color of icons ("āpaper-item-icon-color") MAY BE reassigned to āāsome-variableā if it is defined.
Imagine that user-defined āāsome-variableā is defined in a custom theme - then icons will have this āāsome-variableā color if this theme selected. If a default theme is used (or this variable is not defined in the selected theme) - then a default āāpaper-item-icon-colorā is used.
Unfortunately this code does not work - as well as this:
ha-card {
{% set COLOR = 'var(--paper-item-icon-color)' %}
--paper-item-icon-color: var(--some-variable, {{COLOR}});
}
Seems that a kind of loop occurs here - i.e. code is NOT executed line-by-line.
The only working solution is using an explicit value instead of variable (which is not flexible as it could be):
Hello, I am trying to put some CSS using card-mod into two custom cards combined within each other.
The custom cards are:
button card (the templated one that minimalist ui offers)
swipe card
My issue is that the button card being inside the swipe card does not allow me to swipe as the container of elements inside the button-card is almost as big as the swipe area. To avoid double-posting my issue can be seen here in the swipe thread: Lovelace: Swiper card - #625 by elementoulis
I ended up realizing that card-mod could help me shrink down the container of elements allowing me some more āun-tappableā room for my finger to swipe. But for the love of God I canāt figure out how to target it properly. Iāve discovered that I need to introduce some padding-right: 70px; as seen in the picture below.
I have an issue since a few weeks where the background of a card doesnāt load occassionally. It issue occurs maybe 25% of the times on my phone and 90% of the times on my laptop.
This is only an issue on the first lovelace tab and the content of the card doesnāt matter, same layout on other cards but they work fine. Changing the order of the tabs still causes the issue only on the first tab. I have simplified it to a markdown card with just a table and the word āTestā and I still get the issue. Hitting Ctrl-F5 solves the issue always.
I donāt know if this would improve the situation, but why do you set the variable there and not directly the background? At least, this is one assignment iteration, which can be reduced. And secondly (as workaround), you can apply themes per card as well, if the problem will not be solved, where you can overwrite.as well.
You are assigning your color to the variable --ha-card-background. So here you donāt set the color of the background, but only the variable, which is then only applied in a second step to the background. Possible as well:
Hey guys,
I am struggling with changing the borders of my card as well as animate the icon at the same time. I have tried various combinations of code I found in this thread but as I do not understand how the structure works I cannot find a solution. I only found examples for one or the other. When I copy everything from the example page below, I can get the icon to move. However, the corners do not line up, the background color doesnāt get applied and the border does not show up either.
My goal is to animate the trash can as well as change the color depending on the stat_attr of the calendar. Last but not least everything should fit together nicely. Which I donāt know how to do.
I do not know how to differentiate between ha_card and ha-icon. So it is possible the current version doesnāt make any kind of sense to someone who knows what they are doing.
Iād appreciate any kind of help. Thank you.
edit: I also found the page where the is a code example for the animations. But that leads me to the same problem that I do not know how to put it into my existing code.
Thanks for looking into this, and I see your point which makes sense. I changed the code but unfortunetely the inconcistant behaviour continues.
Edit:
Just realized that this is not background specific but affects all cards in the first tab. A simple text card with a different font is not loaded properly either. As always, a Ctrl-F5 fixes the issue temporarily.
Am I the only one with this issue? Nothing has changed in my code, this started happening a few weeks ago. Have no clue where to start looking or debugging.
And: I donāt think (if I can see it correctly from the path (btw, there you can always find how to address as well, here div.current) on bottom of your screenshot, as the tree is not complete, that you have to go in the shadow, so try .: | instead of $: |
so what did you end up with Tom?
Also having my share of issues here (on another card btw, the new horizon-card) , and hope to find some help in your solutionā¦
NOTE 2: Following on the note above; due to the high level of load order optimization used in Home Assistant, it is not guaranteed that the #shadow-root or the mwc-button actually exists at the point in time when card-mod is looking for it. If you use the second method above, card-mod will be able to retry looking for #shadow-root at a later point, which may lead to more stable operation.
In short; if things seem to be working intermittently - try splitting up the chain.
I previously made this with a markdown card, which is what broke.
After asking here, I subsequently logged this issue, because I could see the <style> wasnāt being injected at all levels. I then later on spotted that some elements are dynamically reloaded, the the style appears shortly before disappearing. I fear thereās nothing card-mod can do about this.