🔹 Card-mod - Super-charge your themes!

Hi, seems i’m seeing now background on my markdown cards, before there was none
cardmod version: 3.1.1

added below to the yaml, seems that helps for chrome browsers
but i still see the background on the HA android companion app?

  extra_module_url:
    - /local/community/lovelace-card-mod/card-mod.js

what am i missing here?

been experimenting in the background with @KTibow on the motion menu settings, and have made some serious progress:

  card-mod-root-yaml: |

    .: |

      ha-button-menu {
        color: {% if is_state('input_boolean.menu_options_template','on')%}transparent /*var(--primary-color)*/
               {% endif %};
      }

      ha-button-menu::before {
        content: "{% if is_state('input_boolean.menu_options_template','on') %} {{states('sensor.temp_current')}}° - {{state_attr('sensor.browsermod_id_safari','path').split('/')[-1].replace('_',' ').capitalize()}} {% endif %}";
        color: var(--text-primary-color);
        visibility: visible;
        position: relative;
        top: 24px;
      }

      /* Uncomment this for header on the bottom. You're 3/3 there.
      app-header {
        top: calc(100vh - 60px) !important;
        bottom: 0 !important;
        transform: unset !important;
      }
      */
   etcetcetc

will now allow and create:
Schermafbeelding 2021-11-28 om 16.12.33
Schermafbeelding 2021-11-28 om 16.12.41
Schermafbeelding 2021-11-28 om 16.12.51

trick is to set the 3 dots color to transparent, and set a separate color And visible to the (template) text.
As you can see it even works based on a boolean, so we can change the layout in the frontend, via the frontend :wink: ofc, that can be anything.

here’s my full theme card mod

Only thing left to do is find a word-wrap setting, soon it doesnt wrap, but shows all on 1 line.

Maybe someone here knows how to do that?

cheers

1 Like

Hi,

Thanks for this, I would not have got there without you and @KTibow’s input. You have saved me a lot of time.

This is what my relevant area of my header now looks like after your help.

image

And here is my theme yaml to achieve it

test:
  card-mod-theme: test
  header-height: 48px
  card-mod-root-yaml: |
    .: |
      ha-menu-button {
        display: none !important;
      }

      ha-button-menu {
        color: transparent;
      }

      ha-button-menu::before {
        content: "{{states('sensor.local_time')}} - {{states('sensor.local_date')}}";
        color: var(--text-primary-color);
        visibility: visible;
        position: absolute;
        font-size: 18px;
        width: 250px;
        top: 15px;
        right: 0px;
      }

I got it NOT to wrap by setting the width and making the position absolute, both were cribbed from the card mod themes wiki (and the original code we all used). Lots of trail and error as I don’t know what I am doing really.

Thanks again for getting me back to where I was a few weeks ago.

check Custom header theme · GitHub

we made it use:

white-space: nowrap;

Schermafbeelding 2021-11-30 om 08.49.51

Good to know - will use that.

Thanks

EDIT: It works a treat! many thanks.

Figured it out in themes

  card-mod-theme: noctis-grey
  
  card-mod-more-info-yaml: |
    ha-more-info-history:
      $: |
        .header > a, a:visited {
          color: var(--secondary-text-color) !important;
          font-size: 12px;
        }
    ha-more-info-logbook:
      $: |
        .header > a, a:visited {
          color: var(--secondary-text-color) !important;
          font-size: 12px;
        }  

Not that agressive anymore

image

But it is only working here, but not within the other tabs like

image

Any hint? I asked this already in card-mod-thread, but hopefully, here are esp. the card-mod-themes experienced user, who can help.

aware this is an old post, but couldn’t find another one remotely close to being effective…

Id like to hide the chevrons (on Mobile). Dont want to hide the app-toolbar completely though, which is what this does.

considering I do this also:


      /* Set the toolbar background. */
      app-header, app-toolbar {
        background: var(--primary-color);
        color: var(--text-primary-color);
      }

can I still hide the chevrons somehow? using only:

      /* Hide chevrons */
      paper-tabs$: |
        .not-visible {
          display: none;
        }

doesnt do anything as far as I can see

Hi Kendell,

I was wondering if I could ask you again for some advice, the code I was using to replace the three dots menu with a clock (which is also listed in the theme cookbook as an example) was working well until I updated to 2021.11. Then it turned back into 3 dots.

I have checked and it doesn’t appear the element names have changed. I also read the recent notes in the thread which provided some ideas how to get it working again, but they didn’t work for me. Here is the code that worked until 2021.11:

      mwc-icon-button[slot="trigger"] > ha-svg-icon {
        display: none;
      }

      mwc-icon-button[slot="trigger"]::after {
        font-size: 20px;
        height: 20px; 
        width: 100px;
        margin-left: 0px;
        margin-right: 0px;
        content: "{{ states('sensor.time') }}";
        position: absolute;
        top: 8px;
        right: 0px;
      }

Here are some things I tried to replace it.

I’ve been able to get the three dots to disappear with this:

      ha-button-menu {
        color: transparent;
      }

but none of the following were able to make the clock reappear:

      ha-button-menu::before {
        font-size: 20px;
        height: 20px; 
        width: 100px;
        margin-left: 0px;
        margin-right: 0px;
        content: "{{ states('sensor.time') }}";
        position: absolute;
        top: 8px;
        right: 0px;
      }

or

      ha-button-menu::before {
        content: "{{ states('sensor.time') }}";
        visibility: visible;
        position: relative;
        top: 24px;
        white-space: nowrap;
      }

or

      ha-button-menu::after {
        font-size: 20px;
        height: 20px; 
        width: 100px;
        margin-left: 0px;
        margin-right: 0px;
        content: "{{ states('sensor.time') }}";
        position: absolute;
        top: 8px;
        right: 0px;
      }

I’ve also tried ajusting top and right a bit, but still nothing. Any ideas?

Hi all,

Does anyone have an idea how to add a border on cards in the integration page?

image

Ask @Mariusthvdb, I helped him out with that.

@scstraus have a look here: Custom header theme · GitHub

working nicely.

next challenge is still open, hide the chevrons in that same header theme. This doesnt work:

      /* Hide chevrons */
      paper-tabs$: |
        .not-visible {
          display: none;
        } 

and somehow I should get at the iron-icon?

Schermafbeelding 2021-12-13 om 16.33.30

Hey guys, can anyone help me with card background styling? I am trying to remove the background but as soon as the card updates the background comes back. Any ideas?
I am using auto-entities and card-mod is loaded as a module in config.

Here is my card :

card:
  show_header_toggle: false
  type: entities
  style: |
    ha-card {
       background: none ;
       --ha-card-box-shadow: none;
       
     } 
filter:
  exclude:
    - state: /standby|off|idle|closed|False|clear|unavailable|paused|locked|away/
    - entity_id: light.*strip
    - entity_id: binary_sensor.monitor*
    - entity_id: switch.power*
    - entity_id: switch.server*
    - entity_id: switch.*alarm
  include:
    - entity_id: group.lights*
      options:
        type: custom:fold-entity-row
        group_config:
          toggle: true
          type: custom:slider-entity-row
    - domain: light
      options:
        secondary_info: brightness
        toggle: true
        type: custom:slider-entity-row
    - domain: lock
    - domain: fan
    - domain: switch
    - domain: cover

type: custom:auto-entities
sort:
  method: none

I would suggest to use the other cord mod thread. This one is more related to theme modding.

Sowwwyy didn’t see there was another thread on this. Moved it, thanks for pointing it out

Hi Marius, @KTibow

Actually all the examples I posted were based on my attempts to implement the method shown in your custom header theme, but unfortunately they all failed to bring back my clock. Though your clear method did get rid of the dots. It may just be positioning as last time I had to use after rather than before, but I couldn’t find any combination that worked.

Do you have any other ideas?

sorry for the late response, I am struggling myself with these options, but maybe look here: homekit-infused/Default.yaml at a188b344fe16e468f1ca2df8b7dec48d8ce05e1c · jimz011/homekit-infused · GitHub Jim does it slightly different.

for me, I am tryin git get the selected background color, using:

        /* Set the background of the currently selected tab .*/
        paper-tab[aria-selected=true] {
          background-color: rgba(99,107,117,0.5);
        }

or

background-color: rgba(var(--primary),0.5);

ofc have the primary se in my main theme as primary: 99,107,117 so we can use it in a rgba(). However, this doesnt work (does nothing).

If I use a color name, it works fine, but then I can not use the opacity it needs. Also it overwrites the

        /* Set the color of the currently selected tab indicator. */
        ha-tabs {
          --paper-tabs-selection-bar-color: black !important;
        }

so we can no longer see that.

Any thoughts on optimizing that?

now that Ildar helped me out on adding a camera view as background of a card with

        ha-card {
          background: url({{state_attr('camera.weerkaart_nl','entity_picture')}});
          /*color: black;*/
          background-repeat: no-repeat;
          background-size: 100%;
        }

I was wondering if card-mod-theme could do the same for a View. according to Card mod Themes · thomasloven/lovelace-card-mod Wiki · GitHub we can set things for
card-mod-view, and maybe use the same? Ofc I did give it a try, but not sure of the syntax for that wasnt successful just yet.

Update

  card-mod-view: |
    hui-masonry-view {
      background: url({{state_attr('camera.weerkaart_nl','entity_picture')}});
    }

actually makes happen!

Dec-23-2021 14-55-25

as does:

  card-mod-view: |
    hui-masonry-view {
      background: url({{state_attr('camera.weerkaart_nl','entity_picture')}});
      background-repeat: no-repeat;
      background-size: 100%;
    }

but you’d need a better stream than the 1 I test right now, showing a bit pixelated…

have to figure out the view-name for the custom:layout views… because right now I can only get it to work for the masonry-view, and not for vertical-view or horizontal-view created by that custom component.

  card-mod-view: |
    hui-masonry-view {
      background: url({{state_attr('camera.weerkaart_nl','entity_picture')}});
    }

    hui-horizontal-view {
      background: url({{state_attr('camera.weerkaart_nl','entity_picture')}});
    }

    hui-vertical-view {
      background: url({{state_attr('camera.weerkaart_nl','entity_picture')}});
    }

update2
found that:

    horizontal-layout {
      background: url({{state_attr('camera.weerkaart_nl','entity_picture')}});
    }

    vertical-layout {
      background: url({{state_attr('camera.weerkaart_nl','entity_picture')}});
    }

make it happen on the other views, probably also for grid-view, but I dont use that,so cant say for sure Doesnt work for Grid layout

trying to find a way to set a camera view on a single view, I found out that:

        paper-tab[aria-label='Weer & Klimaat'] {
          color: {{states('sensor.temperature_color_name')}};
          background: url({{state_attr('camera.weerkaart_nl','entity_picture')}});
        }

sets it to the tab in the menu bar. Pretty useless, but nice to know :wink:

this works too:

    {% if state_attr('sensor.browsermod_safari','path') == '/ui-overview/weer_klimaat' %}
      hui-masonry-view {
        background: url({{state_attr('camera.weerkaart_nl','entity_picture')}});
      }
    {% endif %}

but isnt yet what I am looking for

I need a little help I made a theme and 1 thing I can’t figure out.

Switches

switch-checked-button-color: rgb(138, 180, 248)
switch-checked-track-color: rgb(138, 180, 248)
switch-unchecked-button-color: rgb(172, 176, 185)
switch-unchecked-track-color: rgb(154, 160, 166)

These are my chosen colors for the switches but when I look at my theme the colors are displayed darker than chosen color.

Now I found out that home assistant applies a transparency and this makes my switch color darker.
how do i change this i already tried a few things with the card mod from hacs but i can’t figure it out i hope someone can help me.!!

1 = darker color
2 = the real choosen color
3 = the opacity makes color darker
Naamloos-2|690x388

This is the 1st my post here, can anyone give me a magical kick into the card-mod-themes?
Made a 1st try with this.
I got a themes file:

Custom Theme:
  ...........

  modes:
    light:
      ....
      secondary-text-color: rgb(166,166,166)
      ...

    dark:
      ...
      secondary-text-color: rgb(99,99,99)
      ...
      card-mod-view: |
        #columns .column > * {
          margin: 32px 16px;
        }

I am expecting larger margins (that was an example from Thomas).
And I see nothing(((
Dark theme is applied, variables are used.
What am I doing wrong?

Just added this:

      card-mod-theme: "Custom Theme"

does not help.

Did you start smaler (without dark, liht, …)?

  card-mod-theme: noctis-grey

  card-mod-view-yaml: |
    hui-masonry-view:
      $: |
        #columns .column > * {
          margin: 32px 16px;
        }

is working here and might be a starting point.