Replies: 2 comments 2 replies
-
Looking closer, I realize this may actual be a bug and not a feature request in that the Light Theme actually includes Lines 1 to 3 in 76b495a While the Dark Theme does not: Lines 1 to 2 in 76b495a This could also explain the discrepancy in the documentation, too. Should |
Beta Was this translation helpful? Give feedback.
-
Hey, Westbrook! Apologies for the late response. The light theme having As support for |
Beta Was this translation helpful? Give feedback.
-
Currently, the theme files point to
:host
or.sl-theme-{kind}
which implies that they need to be leveraged within a shadow root:host
or against a managed "root" (something that applied the class). This could happen via an app root (e.g.<my-app>
), in every element via CSS Module scripts and constructible style sheets, or via a little JS magic:I would assume this has to do with optionally delivering themes custom to the app/site in contrast to the default OS preferences.
For developers that are happy relying fully on the OS preferences, would you consider expanding the selector usage (or the processed file output, something like
dark.styles.js
butdark-root.css
) to include:root
and better support OS preference based theming at the top of the page via something like@import url('/path/to/themes/dark.css') screen and (prefers-color-scheme: dark);
(or similar via<link>
or pre-processor)?It seems that at some point this was concidered as this concept was included in the instructions for customizing the light theme, though interestingly not in the instructions for customizing the dark theme.
Appendix
While
light-dark()
is only newly "Baseline", it is a really nice way to address both following OS preferences by default while easily allowing for site local preference application, as seen in this demo.Beta Was this translation helpful? Give feedback.
All reactions