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

I use yaml mode, too.
But with that UI-integrated one. Not via ssh in external editor like Notepad++.
Well, seem that I have to change my behavior.

Stay Safe, crazy times we are living in.

Morning,

so since I updated somethings stopped working. I remember reading they were going to depricate something but I just canā€™t find the thread anymore. Iā€™m pretty sure they wanted to depricate the paper item or something but what Iā€™m kinda confused about is that that is still working, thatā€™s not working is ā€œ.infoā€ I want to hide this part here:

image

it was working just fine with this:

    - type: entities
      entities:
        - input_text.documentation_content
      title: Weitere Dokumentation (optional)
      card_mod:
        style:
          '#states div':
            hui-input-text-entity-row$:
              hui-generic-entity-row$: |
                .info {
                 display: none;
                    }
                state-badge {
                 display: none;
                }
              paper-input$: |
                paper-input-container iron-input {
                  --paper-input-container-shared-input-style_-_width: 55vw;
                }

.info {display: none; } doesnā€™t work anymore, i tried digging deep into the css but nothing Iā€™ve tried worked so far.

from the hui-generic-entity-row.ts

static get styles(): CSSResultGroup {
    return css`
      :host {
        display: flex;
        align-items: center;
        flex-direction: row;
      }
      .info {
        margin-left: 16px;
        margin-right: 8px;
        flex: 1 1 30%;
      }
      .info,
      .info > * {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .flex ::slotted(*) {
        margin-left: 8px;
        min-width: 0;
      }
      .flex ::slotted([slot="secondary"]) {
        margin-left: 0;
      }
      .secondary,
      ha-relative-time {
        color: var(--secondary-text-color);
      }
      state-badge {
        flex: 0 0 40px;
      }
      :host([rtl]) .flex {
        margin-left: 0;
        margin-right: 16px;
      }
      :host([rtl]) .flex ::slotted(*) {
        margin-left: 0;
        margin-right: 8px;
      }
      .pointer {
        cursor: pointer;
      }
    `;
  }
}

Any idea what I missed? Any hint would be appreciated.

1 Like

fyi, adding the player to an entities card makes a difference. Perfectly aligned with the other cards, and exact height of a regular card-header (in my config):

  - type: entities
    entities:
      - type: custom:browser-player
        card_mod:
          style: |
            ha-card {
              height: 48px;
              box-shadow: none;
              margin: -16px;
            }
            .card-content {
              padding-left: 8px;
              padding-top: 0px;
              justify-content: space-between;
            }
            .device-id {
              padding-left: 20px;
              position: absolute;
              left: 0%;
              bottom: -5%;
            }

adding:

        .placeholder {
          display: none;
        }

widens the slider a bit, by taking out an empty placeholder, though still not as much as could be.

tried

 show_name: false

?

1 Like

Where would it go? Since I donā€™t think this is an option for the configuration of Entitites and itā€™s not working as style option either.

Edit:

Thank you for the hint though, I made my life a lot easier and just used name

        name: ' '

image

not the prettiest but it does the trick!

lol, was just about to suggest it, but counā€™t find where i saw that :slight_smile:
ā€¦ every ā€œtweakā€ counts ā€¦ as long as it work :wink:

Sometimes I just like to make my life a lot harder than it has to be lol.
No idea why itā€™s so hard sometimes to see the easy stuff and so easy to get stuck on ā€œI have to do it this way!ā€
thank you, again :wink:

I ā€œblameā€ my lazy nature, gives me a lot of ā€œgoodā€ ideas :laughing:

1 Like

Hi Marius ā€¦ the red Clock in your player menu, is that a ā€œwake-upā€ function, starting the player at scheduled time ?

no, itā€™s just my custom navigation menu, pointing to the alarm clock view. Red means an alarm is active :wink:

Found a ā€œplaygroundā€ for CSS ā€¦ came out with this:

position:relative; right:4px;

try it

PS: Sorry, i see now in your latest ā€œscreenshotā€ you already got id/speaker aligned

ahhh, i thought ā€œdamnā€ wake-up invention :grinning_face_with_smiling_eyes:
PS: i hate alarm-clocks :slight_smile:

tried

{flex-grow: 3;}

on slider (id) .placeholder , or what/how it is

?

Hello,

could you please advise me how to edit the card?
I use this compass card and I would like to change the title of the card (Rychlost a směr větru) so that the title is in Araboto Normal font and size 20px. Keep the rest of the card original.

type: custom:compass-card
indicator_sensors:
  - sensor: sensor.lacrosse_tx141w_senzor_vetru_wd
    indicator:
      type: arrow_inward
value_sensors:
  - sensor: sensor.lacrosse_tx141w_senzor_vetru_ws
header:
  title:
    value: Rychlost a směr větru
language: cz
compass:
  north:
    show: true

try with

style: your CCS here

example above requires card-mod installed, and that you have ā€œAraboto fontsā€ ā€¦ ( if Araboto fonā€™t are your preferred fontā€™s i suggest you define ( Headers / Titles / Box text etc. in your Theme )

That is if you want to use these fontā€™s in your cards, ā€¦ if you already have a card with this font/size defined, it would be helpful to se the ā€œcodeā€

anyone seeing why this will not do its job anymore:

      - entity: sensor.backup_state
        card_mod:
          style: |
            :host {
              --card-mod-icon:
                {% if states(config.entity) == 'backed_up' %} mdi:check-circle
                {% else %} mdi:alert-circle
                {% endif %};

              --paper-item-icon-color:
                {% if states(config.entity) == 'backed_up' %} green
                {% else %} red
                {% endif %};
            }

colors and icon are untouchedā€¦

edit

nvm. they came back. I had re=installed the add-on Google drive backup, to change the backup drives. apparently these sensor entities were deleted and recreated and the Frontend didnt like that.

A cache refresh and page reload brought it back

Hi, After the last update I have a problem with headings.


I tried to add to my theme.yaml: (RESOLVED WITH THIS:)

  mdc-select-label-ink-color: "#FFFFFF"

Thank you Arganto

maybe there is a ā€œheadingā€ line, or you could add one, that is if it really is a ā€œheadingā€ ā€¦ if
1F1F28
is the color ā€œdefinedā€ or the color you want to change, it shouldnā€™t be so hard to find
Go through your Theme, change where you think it might be, maybe ā€œsecondary-colorā€ ā€¦ or so , try change

Sorry, i canā€™t be more specific, as i did ā€œbackupā€ my theme, and after Updating HA, i went through it, thou i did wait until an ā€œupdateā€ came for the specific card, to see if that fixed it for me :), so i really did have to wait long before, it was ā€œauto-fixedā€ by update, only needed to change 1 place, in my Theme ( which by the way also was updated, so it was not hard to compare, updated Theme, with my current ā€¦ before i ā€œappliedā€ the theme update

Edit: try secondy-text-color

@venca.kratky has the same problem as me it seems. I also couldnā€™t find the CSS to change the label.

before I had it under .info like this

card_mod:
  style:
    '#states div':
      hui-input-select-entity-row$:
        hui-generic-entity-row$: |
          .info {
           display: none;
              }

But thatā€™s not working after the update anymore. I couldnā€™t find it anywhere btw so I rolled back to the version 02.9, as 03.03 basically destroyed my homeassistant.

Edit:

Oh I see itā€™s a theme, my bad. If you change it in general then secondary-text-color should work.