-
-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(examples): 📝 added multi-themes example #256
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
I used this approach as well, seems to be the best way to create multiple color themes + light/dark themes. Something I would have like tho, is to have light/dark themes separated from color themes, but that is only doable by having two different contexts, and since next-themes does not exposes the context, we can't do anything about it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks for your contribution @lloydrichards
… multi-theme in readme
…tive themes toggle as active
@pacocoursey Should we also create a vercel deployment for this example? |
@trm217 or @pacocoursey is there anything you need from me to get this merged? I agree that there should probably be some configuration with Vercel, but that's out of my hands I think. Let me know as I have some time this week if need 👍 |
@lloydrichards No, all good, I was just waiting for paco to respond about the vercel deployment for the example. But I suppose we can also discuss that later. |
Goals/Scope
I recently implemented
next-theme
on my own site with the desire to add multiple themes controlled through design tokens. I found that the examples and documentation were not very helpful when it came to structuring my project and so now that I've figured out what works, I want to be able to contribute a minimal example so others might save some time.Description
For the example, I forked the with-app-dir example and added 6 themes to the
global.css
using css variables and then connected these variables to some color utilities in thetailwind.config.ts
. Expanding on the page.ts with a<span>
around the mutli to demo how the tailwind utility is used while keeping the rest using the normal text- and dark:text- to show that tailwind is still respecting the dark mode.Comments
I've not updated the
README.md
with an explanation on using multiple dark themes using thedarkMode: ['class', '[data-theme^="dark-"]'],
since I want to keep the scope of this PR narrow, but this might be nice to update too.