How do you have themes responsively update based on user-theme changes? #669
Replies: 1 comment
-
Ah, I figured it out, thanks to the docs: My final code: html[style*="color-scheme: dark"] {
.shiki,
.shiki span {
color: var(--shiki-dark) !important;
background-color: var(--shiki-dark-bg) !important;
}
}
html[style*="color-scheme: light"] {
.shiki,
.shiki span {
color: var(--shiki-light) !important;
background-color: var(--shiki-light-bg) !important;
}
} Results: Screencast.from.2024-05-05.20-14-21.mp4 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have this site, which uses shiki: https://ember-primitives.pages.dev/3-ui/avatar.md
but, the shiki theme, only loads the dark/light theme that matches the user theme at the time of page load.
you have to refresh the page after changing the theme to get the updated shiki theme.
here is the code I use for that:
so, if the themes have hard-coded hex values, rather than CSS variables, I could see how this problem would manifest.
Are there themes that, by default, use css variables? Or should I be expected to override all the color tokens with css vars myself, manually?
Thanks!!
Beta Was this translation helpful? Give feedback.
All reactions