I'm currently working on a project using Polymer 2 to create a collection of components. However, I've encountered an issue with CSS variables when viewing the components in browsers other than Chrome.
One of my components, a wrapper component called x-page, has a theme property that can be set to either light
or dark
. The CSS for this component looks like this:
:host([light]) {
---color-1: rgb(200,200,200);
---color-2: rgb(210,210,210);
}
:host([dark]) {
---color-1: rgb(10,10,10);
---color-2: rgb(20,20,20);
}
My goal is to use these variables in all child components within this wrapper, including those encapsulated within shadow roots, not just ones slotted directly into the parent component.
While this functionality works as expected in Chrome, it doesn't seem to function properly in other browsers despite utilizing apply-shim polyfill and experimenting with custom styles.
Your assistance in resolving this issue would be greatly appreciated :)