We're actually evolving our support for themes right now. We've been waiting for the implementation of the ^ and ^^ combinators in css, and as of last week, these have landed! These combinators cross ShadowDOM boundaries.
This enables an element to publish (via documentation) a styling api. Then a theme css file can be loaded which targets those elements. Here's an example:
Let's say ui-ratings is an element that can show a series of stars type elements. Each of the stars if given the "star" class.
Then you can write a global rule like this:
.special-theme ^^ ui-ratings,
body ^^ ui-ratings.special-theme {
background: red;
}
This will make all ui-ratings anywhere on the page have a red background. The first selector targets ui-ratings inside elements matching .special-theme. The second selector matches ui-ratings anywhere on the page if it has the special-theme class.
Likewise to style the stars:
.special-theme ^^ ui-ratings ^ .star ,
body ^^ ui-ratings.special-theme ^ .star {
border: 1px solid orange;
}
We'll be publishing more documentation on this in the near term.