[unocss support] How to configure dark mode with unocss? #1855
Answered
by
delucis
spokospace
asked this question in
Q&A
-
Hello, is it possible to add the 'dark' class to the body? |
Beta Was this translation helpful? Give feedback.
Answered by
delucis
May 15, 2024
Replies: 2 comments 1 reply
-
Starlight uses a <html data-theme="dark">
<!-- or -->
<html data-theme="light"> I’ve never used UnoCSS, but based on their presetMini({
dark: {
dark: '[data-theme="dark"]',
light: '[data-theme="light"]',
},
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
spokospace
-
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Starlight uses a
data-theme
attribute on the<html>
element to indicate the current theme, i.e.I’ve never used UnoCSS, but based on their
dark
configuration reference, I think you should be able to configure it to use Starlight’s existing selectors: