P6Dave
(Dave Forrester)
April 1, 2023, 1:55pm
4526
Sorted, thanks. Not quite the solution you posted, although Iām sure that would work too. What didnāt help was that I was using the wrong :host
.
Hereās the working code:
card_mod: null
style: >
{% if is_state('input_boolean.default_battery_storage_mode_correct' , 'on' ) %}
:host { --mdc-select-fill-color: green;}
{% else %}
:host { --mdc-select-fill-color: red; }
{% endif %}
Has anyone modified their expander card with card-mod, particularly the title size and color?
could anyone help me with this? I want to put a background color in green when certain input boolean is true, but itās not working:
type: gauge
entity: sensor.mysensor
name: name
card_mod:
style: |
ha-card[state='on'] {
{% if is_state('input_boolean.mybool', 'on') %}
--ha-card-background: #30bf51;
{% endif %}
}
also tried:
type: gauge
entity: sensor.mysensor
name: name
card_mod: null
style: |
{% if is_state('input_boolean.mybool' , 'on' ) %}
:host {ha-card: green;}
{% else %}
:host {ha-card: red; }
{% endif %}
This is my current attempt sans any advice or input from the community. It does not work ā¦ I know Iām not getting it but, at least for me, Iām not finding it that intuitive what to call or how.
- type: thermostat
entity: climate.dining_room_minisplit_f
card_mod:
style: |
ha-card
.content
.temperature {
display: "{{ states("sensor.dining_room_minisplit_f_current_temperature") }}" !important;
}
Any input yet?
Olivier1974
(Olivier Toussaint)
April 3, 2023, 6:50pm
4531
With new version 2023.4 comes new styling issues.
I canāt understand how to get the right CSS selector
stack-in-card is back with some borders and I know how to correct it using the dev console but impossible to get the right card_mod syntax
To remove the lines, I change the border-style
to none
Can someone please help me?
type: custom:stack-in-card
direction: vertical
cards:
- ...
- ...
- ...
card_mod:
style: |
ha-card: {
border-style: none;
}
is not working ā¦
heinemannj
(Joerg Heinemann)
April 5, 2023, 9:10am
4532
I would like to customize the card header font-size and the header line-height of the ācustom:power-flow-cardā.
type: custom:power-flow-card
title: Power Flow now
min_flow_rate: 3
max_flow_rate: 10
watt_threshold: 7800
kw_decimals: 3
w_decimals: 0
entities:
battery: sensor.battery_charge_discharge_power
battery_charge: sensor.battery_state_of_capacity
grid: sensor.power_meter_active_power
solar: sensor.inverter_input_power
inverted_entities: grid,battery
card_mod:
style: |
ha-card {
width: 360px;
height: 360px;
}
.card-header {
color: red;
font-size: 10px;
line-height: 10px;
padding: 0px;
}
The styling for the ha-card is working but not for the card-header.
Any idea how to manage?
arganto
April 5, 2023, 10:05am
4533
As you can see, the header is in the shadow-root. So you must address it via $. You will find this above in the thread with several examples.
this is for card-mod-theme really, but since you mention the header in the Shadow root now, please have a look how I should change a class to adapt to that?
.: |
ha-card.class-header-margin .card-header {
background-color: var(--background-color-off);
font-weight: 400;
font-size: 20px;
color: var(--text-color-off);
padding: 0px 12px;
margin: 0px 0px 16px 0px;
}
is my current class, and we now need to use:
card_mod:
style:
$: |
.card-header {
background-color: var(--background-color-off);
font-weight: 400;
font-size: 20px;
color: var(--text-color-off);
padding: 0px 12px;
margin: 0px 0px 16px 0px;
}
must be a simple change but I didnt fix it yet, and it killed everything else please have a look how I should adapt the class?
Wrote a new issue on the not changing view icons, now we have 3.2.2 which is a complete rebuild:
opened 10:28AM - 05 Apr 23 UTC
My Home Assistant version: 2023.4.6
My lovelace configuration method (GUI or ā¦ yaml): Yaml
What I am doing:
changing an icon in the view tabs via a template. This has been working up to and including 3.1.4. All updates after that broke this functionality, and there are some other posts in this repo on that.
Maybe the syntax was changed, but no reponse in the community either in that, so for now have to consider it an issue.
Since 2023.4 forces us to update (or manually edit the resource, whihc I have done, and which does indeed still work...) I figured a new issue was useful
What I expected to happen:
have the icon change
What happened instead:
Icon does not change
**Minimal** steps to reproduce:
```yaml
# The least amount of code possible to reproduce my error
card-mod-root-yaml: |
paper-tab[aria-label='Aanwezigheid'] ha-icon$: |
ha-svg-icon {
--card-mod-icon: {{states('sensor.presence_icon')}};
}
paper-tab[aria-label='Verwarming'] ha-icon$: |
ha-svg-icon {
--card-mod-icon: {%- set action = state_attr('climate.front_room','hvac_action') -%}
{%- set icon = {'heating':'radiator','idle':'radiator-disabled'} -%}
mdi:{{icon.get(action,'radiator-off')}};
}
```
# End of code
Error messages from the browser console:
No errors, except the ominous double:
<img width="559" alt="SchermĀafbeelding 2023-04-05 om 12 30 02" src="https://user-images.githubusercontent.com/33354141/230055424-45e19f95-c17c-434b-baa3-a28ec0351cca.png">
which appears although I have set the card via the frontend extra_module_url method
Please have a look if this is a user error, or can be fixed.
thanks!
---
**By putting an X in the boxes ([]) below, I indicate that I:**
- [X] Understand that this is a channel for reporting bugs, not a support forum (https://community.home-assistant.io/).
- [X] Have made sure I am using the latest version of the plugin.
- [X] Have followed the troubleshooting steps of the "Common Problems" section of https://github.com/thomasloven/hass-config/wiki/Lovelace-Plugins.
- [X] Understand that leaving one or more boxes unticked or failure to follow the template above may increase the time required to handle my bug-report, or cause it to be closed without further action.
we can still go back to a slightly modified 3.1.4 (I have it done and works ok, btw, also fixing the Shadow root mods in the .cardheader) but I really dont want to, and hope the card can be updated to bring back that functionality once again
heinemannj
(Joerg Heinemann)
April 5, 2023, 12:30pm
4536
The following is working - Thanks!
card_mod:
style:
$: |
.card-header {
font-size: 14px !important;
line-height: 0px !important;
padding-left: 14px !important;
padding-top: 18px !important;
}
.: |
ha-card {
width: 360px;
height: 380px;
}
I figured out how to make the icon in custom:mushroom-entity-card to spin.
code:
type: custom:mushroom-entity-card
entity: input_boolean.test_switch_card
card_mod:
style: |
mushroom-shape-icon {
{% if states('input_boolean.test_switch_card') == 'on' %}
--card-mod-icon: mdi:lamps;
--shape-animation: spin 1.5s linear infinite;
{% else %}
--card-mod-icon: mdi:lamps-outline;
--shape-animation: spin 1.5s linear;
{% endif %}
}
more info: github link
feel free to add it to your list of example card-mod.
1 Like
dmatik
April 5, 2023, 8:42pm
4538
Hi,
I was using card mod configuration in theme, in order to move the header to the bottom. Seems to be broken after upgrading to 2023.04.
Any suggestion for the solution?
danm89
April 5, 2023, 9:22pm
4539
It appears app-header has been deprecated when using the element inspector. Itās now split into two elements which are .header and .toolbar.
You could try renaming app-header in your card-mod-theme to .header e.g.
card-mod-root-yaml: |
.: |
@media only screen and (max-width: 480px) {
app-header {
display: none;
opacity: 0;
}
}
now becomes
card-mod-root-yaml: |
.: |
@media only screen and (max-width: 480px) {
.header {
display: none;
opacity: 0;
}
}
It semi-working for me using this method, but a consequence of it (at least in my config) is I am unable to actually get the header to fully display ānoneā - this just removes the action buttons but leaves the header there. It also seems to prevent the sidebar from being opened on mobile devices when swiping from left to right.
However for your application of just moving it, rather than hiding it, might work.
dmatik
April 6, 2023, 6:13am
4540
I was able to fix that, using above suggestion for replacing āapp-headerā with ā.headerā, āapp-toolbarā with ā.toolbarā, and some more adjustments.
Here is my full theme configuration, in case anyone want to compare.
minimalist-dmatik:
# Journal
state-icon-color: "rgb(var(--color-theme))"
border-radius: "12px"
error-color: "var(--google-red)"
warning-color: "var(--google-yellow)"
success-color: "var(--google-green)"
info-color: "var(--google-blue)"
divider-color: "rgba(var(--color-theme),.12)"
accent-color: "var(--google-yellow)"
widget-border-radius: "10px"
card-padding: "12px"
masonry-view-card-margin: "6px 4px 4px"
chips-left-margin: "6px"
chips-right-margin: "2px"
view-margins: "0px"
grid-layout-margins: "-10px -2px 12px"
# Card-Mod
This file has been truncated. show original
1 Like
This fix unfortunately isnāt working for me
card-mod-root: |
/* ___________ Bottom tabbar ___________ */
.header {
top: auto;
bottom: 0;
transform: translate3d(0px, 0px, 0px) !important;
backdrop-filter: blur(50px);
-webkit-backdrop-filter: blur(50px);
-moz-backdrop-filter: blur(50px);
-o-backdrop-filter: blur(50px);
-ms-backdrop-filter: blur(50px);
background-color: rgba(var(--contrast1-RGB),0.6) !important;
}
.header::before {
box-shadow: none;
height: 20px;
bottom: -20px;
}
.toolbar {
height: 80px !important;
padding: 4px 8px 20px 8px;
background-color: rgba(0,0,0,0) !important;
}
.header div[sticky] {
margin: -20px 0 20px 0 !important;
transform: none !important;
}
ha-tabs, ha-menu-button, ha-button-menu {
color: var(--contrast20);
}
ha-tabs, paper-tabs {
--paper-tabs-selection-bar-color: none !important;
}
paper-tab {
color: var(--contrast10);
border-radius: 16px;
}
paper-tab.iron-selected {
color: var(--contrast20);
}
ends up just blurring my whole homescreen and leaving the toolbar at the top of the page. Admittedly, Iām not amazing at CSS so I could be really borking this.
Please discuss these card-mod-theme questions in a corresponding thread.
dmatik
April 6, 2023, 8:02am
4543
Hey,
I thought this is card mod thread.
Sadly some card-mod stuff changed as well with 2023.4, in my case none of thesticky
code works anymore. I used this to create a sticky header bar (horizontal-stack) with icons in it, but now the sticky part doesnāt work anymore:
</s> <s>type: custom:mod-card</s> <s>card_mod:</s> <s> style: |</s> <s> ha-card {</s> <s> --ha-card-background: var(--primary-color) !important; </s> <s> height: 40px !important;</s> <s> background: var(--primary-color) !important;</s> <s> border-radius: 0px !important;</s> <s> -webkit-box-shadow: var(--ha-card-box-shadow); </s> <s> -moz-box-shadow: var(--ha-card-box-shadow); </s> <s> box-shadow: var(--ha-card-box-shadow); </s> <s> } </s> <s> .card-content {</s> <s> padding: 0</s> <s> } </s> <s> :host {</s> <s> z-index: 999;</s> <s> position: sticky !important;</s> <s> position: -webkit-sticky !important;</s> <s> top: 0;</s> <s> } </s> <s>
Edit: sticky element was broken due to Kiosk Mode module. I always used to hide my header with card-mod theme. However, since that was broken I decided to try the new Kiosk Mode at teh same time as when I upgraded everything else. Disabling Kiosk Mode, fixes sticky cards again.
not sure if I see what that does, but why not simply use that stack without any card_mod? I have a horizontal stack as menu bar on all of my views as is
edit
wait, it does this: How To Create a Sticky Element ?
that Is cool now I want that too, mine scroll away indeedā¦