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

I think you mean removed, not centered.

No, I definately mean centered.
Another axample:
The art_nouveau theme makes this:
image
the airy one (now modified):
image
it seems, that pictures in the art_nouveau format are aligned left and not centered

Theyā€™re just example themes, not actually meant for you to use them.

I know that, no problem at all.
But is there a css element, which not only styles the backgound but centers the picture of a background?
:wink:
By the way: Iā€™ve learned a lot with these themes.
And that was the goal, wasnā€™t it

https://www.w3schools.com/cssref/css3_pr_background.asp

1 Like

Thanks, that helped to solve the problem:

ha-state-label-badge $ ha-label-badge $: |
      .label-badge {
         background-position: center !important;
         background-repeat: no-repeat !important;
         background-size: cover !important;
      }

image

Whitespace at the bottom when adding ?kiosk to end of my url. Actually, even without adding, just when installing kiosk-mode.
The whitespace is uneven. Sidebar bg is css code, main container bg is an image.

Any help is much appreciated.

Is there the possibility of hiding the menu entirely at the top and the possibility of opening the menu on the left?
I built my theme in order to have only one view and the navigation is done by buttons.

The kiosk solution is not suitable because it can be easily deactivated in my opinion (remove kiok characters).

So I want to know, if we can hide all the menu: at the top (the buttons) and prevent the opening of the left menu?

Thank you for your help.

PS: I just noticed that without CH, browsing on android mobile is much faster than before ā€¦ At least one good thing ā€¦ the only one.

Sorry but understandable that CH stops.

You should be using a kiosk app if

Try Fully Kiosk Browser

I wanted to be able to use card-mod to enable a compact header without needing to change my existing theme. Since the card-mod-theme variable is basically a CSS variable, I hacked this together:

You simply need to:

  • Add the compact-header.yaml as a theme (you donā€™t need to actually select it as your theme)
  • Add compact-header-enabler.js to your www folder and include it in your Lovelace resources.

You can also use this with any other theme you want to use as a card-mod theme, simply change the header.enableCompactHeader(); in compact-header-enabler.js with header.enableCompactHeader("name of your card-mod theme");

Edit: The script fires a settheme event passing the currently selected theme to force the page to rebuild.
This may only work if you are using browser-mod (otherwise you will need to navigate to another dashboard and back) and may possibly cause weird effects (Iā€™ve not had any problems myself so far).

2 Likes

Wrong place, kiosk JS isnā€™t related to card-mod.

1 Like

would this card-mod for custom header also allow for customized icons depending on states of entities?

before Lovelace, we could customize the group icon of the page we were on, with CH add-on, we could simply use:

tab_icons:
  developer: >-
    {{states('sensor.developer_icon')}}

but now we seem to be back to a single icon for each view?

secondly, Iā€™d love to be able to color those icons in a same way:

tabs_color:
  developer: >-
    {{'red' if is_state('binary_sensor.github_repo_has_update','on')}}

please help me find out if this is possible, it would so enhance the visual feedback of the current header.

Iā€™m sorry similar questions have been asked. Iā€™ve been trying to make the header more compact but canā€™t get it working. I even tried using the ā€œgoogle light themeā€ but it doesnt change my header:

Google Light Theme:
  # Header:
  app-header-background-color: "#F8F8F8"
  app-header-text-color: "#424242"
  # Main Interface Colors
  primary-color: "#5F9BEA"
  light-primary-color: var(--primary-color)
  primary-background-color: "#F8F8F8"
  secondary-background-color: var(--primary-background-color)
  divider-color: var(--primary-background-color)
  # More stuff here that I cut out
  card-mod-theme: "Google Light Theme"
  # Header
  card-mod-root-yaml: |
    paper-tabs$: |
      .not-visible {
        display: none;
      }
      /*Uncomment this if you want the header on the bottom
      #selectionBar {
        bottom: unset !important;
      }
      */
      /*More stuff I cut out*/

Iā€™ve reloaded the themes and I have choosen the theme in the editor. I previously used custom header but I donā€™t keep it in my current dashboard-yaml.

Here is my dashboard:

views:
  - panel: true
    theme: Google Light Theme
    title: Home
    background: '#272E38'
    badges: []
    cards:
      - type: vertical-stack
        cards:
          - type: vertical-stack
            cards:
              - type: vertical-stack
                cards:
                  - type: glance
                    entities:
                      - entity: sensor.nextsunrise
                      - entity: sensor.nextsunset
                    show_name: false
                    show_state: true
                    state_color: false
  - title: Scenes
    path: scenes
    theme: Google Light Theme
    badges: []
    background: '#272E38'
    cards:
      - type: entities
        entities:
          - entity: group.light
        title: Turn off

Thatā€™s just an example, as you can clearly see:

Itā€™s a general example of how you can merge a theme. Replace all of this:

With your theme.
Replace this with your theme name:

And then get the full compact header code over at Theme cookbook Ā· thomasloven/lovelace-card-mod Wiki Ā· GitHub

Yeah! You can do that! Try adding something like

paper-tab[label="My Tab Title"] {
  color: red;
}

To the end of the compact header code.

By the way, looks like we might be going compact in 0.117!


Of course, I think you still might need card-mod for additional modding.

ok, thanks, cool.
Is this for individual tabs? or a generic tab mod.
And, did you have a look at the icon question? can we change that according to states (like:

      value_template: &icon
        >
          {% set presence = states('sensor.family_home') %}
          {% set mapper = {'0':'mdi:account-off',
                           '1':'mdi:account',
                           '2':'mdi:account-multiple',
                           '3':'mdi:account-multiple-check'} %}
          {{mapper[presence] if presence in mapper else 'mdi:account-group'}}

?

You can select all paper-tabs including the selected one if you remove the bracket stuff at the end, but right now you change the name to the tab you want to style. And Jinja is supported, hereā€™s an example:

  card-mod-row-yaml: |
    "*:first-child$": |
      @keyframes spin {
        0% {
          transform: rotate(0deg);
        }
        100% {
          transform: rotate(359deg);
        }
      }
      state-badge {
        {% if config.entity.startswith('fan.') and is_state(config.entity, 'on') %}
          animation: spin 4s infinite linear;
        {% endif %}
      }
1 Like

thanks! will start experimenting on the test instance :wink:

I fear though this is going to be such a complex card-mod, it would be better if a dedicated add-on would take up on thisā€¦ why o why did CH have to goā€¦

taking in to account we dont have the internal variables anymore, unless card-mod gives us these too? So we can show the tab-name (View name) in the header. And can template based on those variables.

Maybe we should all see what 117 brings us, and continue from there.