šŸ”¹ Card-mod - Super-charge your themes!

First of all, sorry for touching the eggs so much ā€¦
I canā€™t remove the chevrons and the three dots when I try the side menu button disappears, letā€™s see if someone can help me, this is how I have it now:

  card-mod-theme: personal
  card-mod-root-yaml: |
    paper-tabs:
      $: |
        .not-visible {
          display: none;
        }
        /*Uncomment this if you want the header on the bottom
        #selectionBar {
          bottom: unset !important;
        }*/
    "ha-app-layout":
      $: |
        #contentContainer {
          padding-top: 48px !important; /*Change this to 0px if you want the header on the bottom*/
        }
    .: |
      app-toolbar {
        height: 0;
      }
      .edit-mode, app-header, app-toolbar {
        background-color: transparent !important;
        background: url('/local/fondo_negro.png') !important;
      }
      /*Uncomment this if you want the header on the bottom
      app-header {
        top: calc(100vh - 48px) !important;
      }
      */
      app-header.edit-mode {
        border-bottom: 2px var(--primary-color) solid;
        padding-bottom: 10px;
      }
      app-header[shadow] > ::before {
        box-shadow: inset 0px 5px 6px -3px rgba(0, 0, 0, 0.3);
      }
      #add-view ha-svg-icon {
        background-color: var(--primary-color) !important;
        color: #EEE !important;
        border-radius: 5px !important;
      }
      .edit-icon {
        color: var(--primary-color) !important;
      }
      mwc-icon-button[label="Start conversation"] {
        top: 0;
        right: calc(48px * 1);
        z-index: 2;
        position: absolute;
      }
      mwc-icon-button[title="Help"] {
        top: 0;
        right: calc(48px * 2);
        position: absolute;
        z-index: 2;
      }
      mwc-icon-button[title="Close"] {
        top: 0;
        left: 0;
        position: absolute;
        z-index: 2;
      }
      mwc-icon-button#add-view {
        position: fixed;
        right: calc(48px * 1);
      }
      ha-button-menu {
        top: 0;
        right: 0;
        z-index: 2;
        margin-left: 5px;
        position: absolute;
        /*Uncomment this out to hide the overflow menu
        display: none;
        */
      }
      app-toolbar > [main-title] {
        display: none;
      }
      menu-button[style="visibility: hidden;"] {
        display: none;
      }
      ha-menu-button {
        z-index: 2;
        top: 24px;
      }
      paper-tabs {
        --paper-tabs-selection-bar-color: transparent !important;
        margin-left: 65px !important;
      }
      paper-tab[aria-selected="true"] > ha-icon {
        color: orange !important;
      }
      paper-tab[aria-selected="true"] {
        color: var(--primary-color) !important;
      }
      @media (orientation: portrait) {
        paper-tabs {
          margin-left: 64px !important;
          margin-right: 32px !important;
        }
        ch-header > paper-tabs,
        app-header.edit-mode > * > paper-tabs {
          margin-left: 10px !important;
          margin-right: 10px !important;
        }
      }
      ch-header > ha-button-menu {
        top: unset;
      }
      ch-header > paper-tabs,
      app-header.edit-mode > paper-tabs {
        margin-left: 0;
      }
      app-toolbar a {
        color: var(--primary-text-color) !important;
      }

Hello everyone
How can I fix this situation ?

Screenshot_107

Thanks for the reply. The badge-card does not have an ā€œha-cardā€ element (I guess element is the correct terminology to use, or should I say it is not derived from the ā€œha-cardā€ style?) So, when replacing the ā€œ.ā€ with ā€œha-cardā€, it still doesnā€™t work.

When I inspect the badge-card I see:

  • element
  • .cards
  • element (inherited from hui-view)
  • :host (inherited from hui-root)
  • :host (inherited from home-assistant-main)
  • element (inherited from home-assistant)
  • ā€¦

What I was trying to do, and given my limited understanding of CSS I donā€™t if this is possible, is to end up with whatā€™s shown below. I thought the ā€œ.ā€ selector applied the style to the current element, which in the case would be the badge-card.

<badge-card style="border-left-width: 7px;border-left-style: solid;border-top-width: 7px;border-top-style: solid;border-right-width: 7px;border-right-style: solid;border-bottom-width: 7px;border-bottom-style: solid;">

Thanks again for your help.

Are you trying to style badges? Most cards are moddable with ha-card.

You can increase the margin-right. So I can help you, are you on mobile?

I need an odd number of votes so that the overflow button isnā€™t 50%. If you havenā€™t voted yet, please vote.

1 Like

Thank you, everything worked out.
Added here:

paper-tabs {
        --paper-tabs-selection-bar-color: var(--primary-color) !important;
        margin-left: 48px !important;
        margin-right: 30px !important;
}
1 Like

Put together a quick compact-header config for this in case anyone is interested. Itā€™s just the standard compact header look, wonā€™t affect edit mode (aside from shifting cards, will look for a fix), and should keep backgrounds and cards in the view unaffected. Commented as much as possible for any adjustments that would be needed.

compact-header:
  card-mod-theme: compact-header
  card-mod-root-yaml: |

    ha-app-layout$: |
        /* This corrects top padding for the view. */
        #contentContainer {
          padding-top: 48px !important;
        }

    paper-tabs$: |
        /* This hides tab scroll arrows, remove next 3 lines if you want them. */
        paper-icon-button {
          display: none;
        }
        /* This makes it so arrows are only displayed when needed. */
        .not-visible {
          display: none;
        }
    .: |
      /* This shifts the unused portion of the header up. */
      app-toolbar:not([class="edit-mode"]) {
        margin-top: -64px;
        z-index: 1;
      }
      /* This shifts the menu button back down. */
      app-toolbar:not([class="edit-mode"]) ha-button-menu {
        margin-top: 110px
      }
      /* This shifts the voice button back down. */
      app-toolbar:not([class="edit-mode"]) mwc-icon-button[label] {
        /* Uncomment line below to hide voice button. */
        /* display: none; */
        margin-top: 110px
      }
      /* This shifts the options button back down. */
      app-toolbar:not([class="edit-mode"]) ha-menu-button {
        /* Uncomment line below to hide options button. */
        /* display: none; */
        margin-top: 110px
      }
      /* This hides the menu button when sidebar is open. */
      menu-button[style="visibility: hidden;"] {
        display: none;
      }
      /* This adds room for the menu button when sidebar is open. */
      :host-context(home-assistant-main[expanded]) paper-tabs {
        margin-left: 60px !important;
      }
      /* This leaves space for the buttons on the right of the tabs bar.
         Change 112px to 56px if you don't use voice icon. */
      paper-tabs {
          margin-right: 112px !important;
      }
      /* This corrects the sizing of the view. */
      #view {
        min-height: calc(100vh - 48px) !important;
      }
34 Likes

You sir are AWESOME !!

Do you know if there is a way to have your config above and still have the Home Assistant dark mode get applied?

A few of us are unable to get this going. Once you set a theme, the dark mode no longer gets applied. We even created a theme called ā€œdefaultā€ but it only shows the light mode colors.

Nice! How well does it do on mobile? Do the top of cards get cut off in edit mode?

@stephack This is literally the first card-mod config Iā€™ve made, so I donā€™t really know how to help with that.

@KTibow Just noticed that they do, but it should be easy enough to fix that since you can check for both edit mode and mobile. Otherwise, it works as it should on mobile.

Edit: Looks like that edit mode fix might not be as easy as I thought since the element that is causing the shift isnā€™t contained in the element that indicates edit mode. Iā€™ll look into it more when I can.

Iā€™m going to try to merge yours with mine on the wiki, giving that yours has comments and some shorter stuff sometimes.

after dozens of attempts I canā€™t, someone can tell me how to remove the 3 points on the right without the side menu button disappearing

Show config?

right now I have it like this:

  card-mod-root-yaml: |
    paper-tabs$: |
        /* This hides tab scroll arrows, remove next 3 lines if you want them. */
        paper-icon-button {
          display: none;
        }
        /* This makes it so arrows are only displayed when needed. */
        .not-visible {
          display: none;
        }
    "ha-app-layout":
      $: |
        #contentContainer {
          padding-top: 48px !important; /*Change this to 0px if you want the header on the bottom*/
        }
    .: |
      app-toolbar {
        height: 0;
      }
      .edit-mode, app-header, app-toolbar {
        background-color: transparent !important;
        background: url('/local/fondo_negro.png') !important;
      }
      /*Uncomment this if you want the header on the bottom
      app-header {
        top: calc(100vh - 48px) !important;
      }
      */
      app-header.edit-mode {
        border-bottom: 2px var(--primary-color) solid;
        padding-bottom: 10px;
      }
      app-header[shadow] > ::before {
        box-shadow: inset 0px 5px 6px -3px rgba(0, 0, 0, 0.3);
      }
      #add-view ha-svg-icon {
        background-color: var(--primary-color) !important;
        color: #EEE !important;
        border-radius: 5px !important;
      }
      .edit-icon {
        color: var(--primary-color) !important;
      }
      mwc-icon-button[label="Start conversation"] {
        top: 0;
        right: calc(48px * 1);
        z-index: 2;
        position: absolute;
      }
      mwc-icon-button[title="Help"] {
        top: 0;
        right: calc(48px * 2);
        position: absolute;
        z-index: 2;
      }
      mwc-icon-button[title="Close"] {
        top: 0;
        left: 0;
        position: absolute;
        z-index: 2;
      }
      mwc-icon-button#add-view {
        position: fixed;
        right: calc(48px * 1);
      }
      ha-button-menu {
        top: 0;
        right: 0;
        z-index: 2;
        margin-left: 5px;
        position: absolute;
        /*Uncomment this out to hide the overflow menu
        display: none;
        */
      }
      app-toolbar > [main-title] {
        display: none;
      }
      menu-button[style="visibility: hidden;"] {
        display: none;
      }
      ha-menu-button {
        z-index: 2;
        top: 24px;
      }
      paper-tabs {
        --paper-tabs-selection-bar-color: transparent !important;
        margin-left: 65px !important;
      }
      paper-tab[aria-selected="true"] > ha-icon {
        color: orange !important;
      }
      paper-tab[aria-selected="true"] {
        color: var(--primary-color) !important;
      }
      @media (orientation: portrait) {
        paper-tabs {
          margin-left: 55px !important;
          margin-right: 0px !important;
        }
        ch-header > paper-tabs,
        app-header.edit-mode > * > paper-tabs {
          margin-left: 10px !important;
          margin-right: 10px !important;
        }
      }
      ch-header > ha-button-menu {
        top: unset;
      }
      ch-header > paper-tabs,
      app-header.edit-mode > paper-tabs {
        margin-left: 0;
      }
      app-toolbar a {
        color: var(--primary-text-color) !important;
      }

1 Like

Screenshot of it not working? On mobile it should hide the sidebar button, so swipe from left to right instead.

There is no swipe, I donā€™t want it either, I just want to remove the 3 points on the right and if it is not too much to ask, change the color of the views that are not active.
I would like to have it as before:

Uncomment the part that says ā€œuncomment this out to hide the overflow menuā€ (yes itā€™s called an overflow menu). As for the other one, change

      .edit-mode, app-header, app-toolbar {
        background-color: transparent !important;
        background: url('/local/fondo_negro.png') !important;
      }

to

      .edit-mode, app-header, app-toolbar {
        background-color: transparent !important;
        background: url('/local/fondo_negro.png') !important;
        color: red;
      }

Change red to your color

1 Like

hallelujah, thank you so much

Is there any way to add transparent background to Maykers above code?
Iā€™ve been trying for about an hour and canā€™t get itā€¦

Thanks

Set app-header-background-color and app-header-text-color.