Skip to content
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

Closed
bph opened this issue Nov 14, 2024 · 8 comments
Closed

How to build light/dark mode with theme.json #336

bph opened this issue Nov 14, 2024 · 8 comments

Comments

@bph
Copy link
Collaborator

bph commented Nov 14, 2024

Discussed in #331

Originally posted by justintadlock November 5, 2024
Using color-scheme and light-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.

@bph
Copy link
Collaborator Author

bph commented Dec 2, 2024

An interesting list of methods in the outreach channel

@justintadlock
Copy link

Working on this here and expect to have the first draft finished tomorrow: https://docs.google.com/document/d/1GUIICX4H8GDWZ5B2SMqsRwSwaXYFz5ndN1Y0erPS-g8/edit?usp=sharing

@justintadlock justintadlock moved this from To-do to In Progress in Developer Blog Content Board Dec 16, 2024
@justintadlock justintadlock moved this from In Progress to Needs 1st review in Developer Blog Content Board Dec 17, 2024
@justintadlock
Copy link

Ready for reviews! 🎉

@ndiego
Copy link
Member

ndiego commented Dec 18, 2024

The first review is complete. Left a few minor suggestions. Great article, learned a lot about the CSS spec for light dark 👌

@ndiego ndiego moved this from Needs 1st review to Done w/ 1st Review in Developer Blog Content Board Dec 18, 2024
@justintadlock justintadlock moved this from Done w/ 1st Review to Needs 2nd review in Developer Blog Content Board Dec 18, 2024
@justintadlock
Copy link

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!

@ryanwelcher
Copy link

Second review is done. No suggestions from me.

@justintadlock justintadlock moved this from Needs 2nd review to Ready to publish in Developer Blog Content Board Dec 18, 2024
@justintadlock
Copy link

All right. Post is moved to the Dev Blog in draft mode. I plan to publish on Thursday.

@justintadlock justintadlock moved this from Ready to publish to Published (Done) in Developer Blog Content Board Dec 19, 2024
@justintadlock
Copy link

Social Copy:

Learn how to create light and dark mode color schemes for your block themes using theme.json:

https://developer.wordpress.org/news/2024/12/mastering-light-and-dark-mode-styling-in-block-themes/

@github-project-automation github-project-automation bot moved this from Published (Done) to Ready to publish in Developer Blog Content Board Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Ready to publish
Development

No branches or pull requests

4 participants