Hi there, I created my custom theme which uses card_mod to apply various styles. But there’s one element I cannot seem to change named “ha-switch”. It’s the toggle within an ha-card.
I’ve tried various selectors and also tried card-mod-helper. But that gave me an enormous selector which didn’t work either.
Anyone an idea to override the styles within ha-switch if it’s nested in an ha-card? I would like to change the opacity of the track as it’s not 100% by default.
The part of my current theme where I tried to apply the styles:
But all the selectors so far didn’t seem to work. Maybe it has something to do with the switches being inside a vertical-stack/grid. So for now I’ll leave it for what is it.
Switch track remains with 0.54 opacity but it’s acceptable.
My selectors work even when in a stack or row. It looks like you erroneously added hui-generic-entity-row to your selectors. While the toggles switches are within that element, they are not within it’s shadow-root so you shouldn’t include it in the card-mod selector. Try this instead:
if I add these files to my HA with the same file structure as the GitHub says of course will my toggle switches look like material3 themed like they do on your material-rounded theme? If so that’s exactly what I want
Nope, those are the uncompiled files. In my order to use them in Home Assistant you have to either use my theme or compile them into a card-mod theme yourself. This file is my themes pre-commit build pipeline, but the gist of it is is that the CSS files have to be copied into the YAML files where they’re referenced with jinja, and then those YAML files have to be copied into their corresponding card-mod-*-yaml fields.
Nice, I’m jealous, wish I could style them in such a way! Looks so easy but for some reason for me as a experienced front-end developer, I cannot manage to sort this out
@Nerwyn thanks for taking your time to help. I’ve tried your suggestions but unfortunately it’s not working. Last week I’ve spent several hours with a lot of selectors to fix it, but none of them seem to work. Also the card_mod HTML output seems odd, not sure if it’s what is suppose to be: