Some styling may only be solved by a directs access to CSS properties, not by changing theme variables. May be this is your case. Open Code Inspector and experiment.
Hello. Excuse my attempt to describe this. I don’t fully understand CSS or the terms to properly talk about it, but I’m hoping someone might be able to assist me with this. I have a vertical stack card configuration. At the top of the stack I have a template sensor. I made the font bigger with card mod but the font is clipped/cut off. I inspected the page and drilled down to get down to the div section where the text of my sensor exists. On the right side in the style tab there is an overflow property that when I unselect the sensor texts shows properly. So I suspect I need to somehow manipulate that with card mod but I am not having luck messing around with this.
I copied the JS path and used card mod helper to get this which is what I clicked through to get down to the sensor text. It shows the path but I’m at a loss on what to do next. Any assistance would be greatly appreciated. Thanks!
You basically have two choices, either make the card bigger or allow the overflow to show (e.g. let the text go outside of the boundaries of the div/card). I’d go with the former, so try to add height: 45px to your code. If it doesn’t work, try with !important.
because it actually removes the said properties, so the cursor doesnt respond to that.
maybe we can even hide the entity all together in a single mod, have to figure that out yet
Hi
Trying to change the background of my icon based on the state of the device .
I changed the color of the icon and the background but but not sure how to change it’s icon background
Here is my code
card_mod:
style: |
ha-card {
background-color:{{'orange' if is_state('binary_sensor.XXX', 'on') else 'white'}};
--card-mod-icon-color: {{'white' if is_state('binary_sensor.XXX', 'on') else 'black'}};
--primary-text-color: {{'white' if is_state('binary_sensor.XXX', 'on') else 'black'}};
--secondary-text-color: {{'white' if is_state('binary_sensor.XXX', 'on') else 'grey'}};
}
trying to mod a glance cards border and use that card in a grid, there is the odd situation that using a border-top, simply add the height of the border to the picture-glance and takes the grid out of proportion.
I tried to make the top order be inline, but could not find the correct css for that. This does in fact create inline border, but only left and right…
Thanks for taking the time to assist. Correct, the card size is ok. I would leave it bigger if it adjusted the font clipping but that doesn’t seem to help.
Here is what it looks like when I adjust the card height.
Hey guys. I’m stumped on this.
Is there a (probably simple) way to make the padding change consistent, when the mini media player entity changes to ‘–inactive’ the code ceases to work.
Many Thanks
---- Edit ----
I found the answer. ‘!important’. Damn i feel dumb
Hi
I feel like I have tried everything: I want to change the color of the bars i plot in a mini-graph-card with an if-statement based on which hour it is to highlight which bar represents the current electricity price. I thought card-mod is the best way to go but I can’t find out even how to change the color with card-mod. I have tried place the card-mod code in different places but I don’t really know what i’m doing. I can change the color with the “color entry” when i add the entitiy to the graph but not with card-mod to include the if-statement. Any suggestions how to proceed here? Perhaps there is another smarter way than if-statement based on the current hour?
The image should show what I’m after, The code I have right now is below… i have removed some entity entries just to make the code a bit more readable.
This works for a “show 1 graph” case.
In your case a code contains 3 graphs (one with “show_graph: false”) - so adapt this style for your case.
To select some bar you need to use smth like “nth-child(17)”.
Each bar corresponds to some hour. If you need to select the current hour - this will be the LAST bar.
Goto 1st post → link at the bottom → styles for mini-graph-card → How to set a color for the last bar.
If you need to select SOME PARTICULAR bar - then use this:
card_mod:
style: |
{% set INDEX = ................ -%}
.graph__container__svg svg g.bars .bar:nth-child({{INDEX}}) {
fill: grey;
}
where you need to specify a formula for the “INDEX” value.
first I set it to the ha-card, but that was moot, since I use these picture-element cards to navigate to my rooms… only looked for a way to have the bottom-section icons be non-responsive.
this seems to work as hoped for, posting here for others to help, and if something could be optimized, please do (as always the challenge is in combining several styling aspects, in the case the border on the card. the [[]] originate the decluttering template I use for these Navigating cards):