I have an angular webcomponent that I build with the help of @angular/elements. The webcomponent has been working in my website for months, so most of the code, deployment and loading is ok.
The problem
I am currently trying to add angular material to that webcomponent. During development everything works fine but as soon as I try to add it to my page, the styles of the material components are not right.
I think I have narrowed the problem to the prebuilt material theme that I use (@angular/material/prebuilt-themes/azure-blue.css).
In that file a lot of css variables are defined for the html element.
html {
--mat-app-background-color:#faf9fd;
--mat-app-text-color:#1a1b1f;
...
}
Such variables are then used to style angular material components (eg. mat-button).
But the css for the webcomponent (including the css of that theme) are added in a <style> block inside of the shadow root of my webcomponent. I guess the problem is, that the code inside the shadow root has no access to the html element of the page.
Any idea how to tackle that problem? Unfortunately I find no how-to/tutorial that explains that part.