-
Notifications
You must be signed in to change notification settings - Fork 7
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
How to build light/dark mode with theme.json #336
Comments
An interesting list of methods in the outreach channel |
Working on this here and expect to have the first draft finished tomorrow: https://docs.google.com/document/d/1GUIICX4H8GDWZ5B2SMqsRwSwaXYFz5ndN1Y0erPS-g8/edit?usp=sharing |
Ready for reviews! 🎉 |
The first review is complete. Left a few minor suggestions. Great article, learned a lot about the CSS spec for light dark 👌 |
Yep, it's really neat what you can do with just basic, modern CSS for this now. No more complex methods! |
Second review is done. No suggestions from me. |
All right. Post is moved to the Dev Blog in draft mode. I plan to publish on Thursday. |
Social Copy:
|
Discussed in #331
Originally posted by justintadlock November 5, 2024
Using
color-scheme
andlight-dark()
, which both have pretty widespread browser support, theme authors can start building color palettes that support the user's OS preferences.This proposal is for a topic that would walk readers through creating color palettes that work with system preferences without ever leaving
theme.json
(well, at least for the front end).There is one minor thing: the color picker in the editor requires a few lines of code to work.
Here's an example repo of a TT4 child theme of this in action: https://github.com/justintadlock/tt4-dark-mode
Stretch goal for the tutorial: There may be a possibility of explaining how to create a light/dark toggle with Block Bindings and the Interactivity API (haven't worked this out yet). This could be a fun addition to the tutorial but is not a hard requirement.
The text was updated successfully, but these errors were encountered: