I'm looking for a way to listening with MutationObserver for a changes in CSS custom vars, actually i'm using the CSS custom vars defined into main index.html file to trigger the different themes of the Web contents. What i want it's a clean MutationObserver solution i can use in all / parent /child CustomElements to listening for a changes of a CSS custom var on that DOM element rules from the changes of the CSS custom var in the index.html main file.
Actually i cannot listening for a changes propagate down the three from a CSS Custom var. Eg. the code i'm using in the CustomElement to listening for the style changes:
#initObserver () {
const brand = this.renderRoot.querySelector('#brand')
const observer = new MutationObserver(
this.#customStylesMutation
)
observer.observe(brand, {
attributes: true,
attributeFilter : ['style']
})
}