Skip to content

How to set body background color in globalStyle with vars from theme? #649

Answered by lucasrabiec
lucasrabiec asked this question in Q&A
Discussion options

You must be logged in to vote

Ok. I found a way that works:

export default function App() {
  document.body.className = lightTheme;
  ...

but maybe there is a better solution.
Some ideas?

Edit:
I found another solution with global styling and switching themes via hook: https://codesandbox.io/s/vanilla-extract-global-theme-rmz79?file=/src/vars.css.ts:1008-1049

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lucasrabiec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant