Understand card-mod v4 application and patching
masterCard-mod v4 uses different methods to apply styles depending on the card's structure. It is important to distinguish between these three terms:
- patch/patching: card-mod is injecting code into the element class.
- application/applying: card-mod applies a
card_modobject to an element (usually in theshadowRoot) and its children based on selectors. - ignore/ignoring: the element patching code takes no action when running at the element level.
In standard Home Assistant cards (like the tile card), card-mod patches the hui-card level. It uses :host { } for base CSS styles and ha-card { } for card styles. It specifically ignores the ha-card patch in standard structures to avoid conflicts with the standard theming model.