pacocoursey / next-themes

Perfect Next.js dark mode in 2 lines of code. Support System preference and any other theme with no flashing
https://next-themes-example.vercel.app/
MIT License
5.16k stars 188 forks source link

How to implement 2 theme provider ? #215

Open codingwithashu opened 1 year ago

codingwithashu commented 1 year ago

I have a landing & dashboard where the landing has a separate ThemeProvider with dark mode and the dashboard has a separate ThemeProvider with a light mode, Whenever I go from the landing page to the dashboard theme mode does not change.

Dashboard - image

Landing -

image

image

n-batalha commented 11 months ago

Another use case is a render side by side of different themes in storybook.

side-by-side

https://storybook.js.org/blog/how-to-add-a-theme-switcher-to-storybook/

I suspected the shared theme setting might be due to the use of localstorage with a shared default key, but it's not the issue.

trm217 commented 6 months ago

As of now, the attribute / class that controls the theming is set on the document element. @pacocoursey perhaps in v1, we could allow defining what element to set the theme value on, what do you think?

ariburaco commented 2 months ago

Just wondering is there any update on this implementation?

trm217 commented 2 months ago

@ariburaco Unfortunately, no.