tailwindcss-multi-theme icon indicating copy to clipboard operation
tailwindcss-multi-theme copied to clipboard

feat(integrations): Watch for changes to dark mode

Open JNavith opened this issue 5 years ago • 2 comments

👋 Hi, right now when people visit a website using the prefers-dark.js script, it'll only set the theme at the beginning when they load the page, so if they change their system theme afterward, it won't be updated on the site.

This pull request, which is modeled after https://github.com/ChanceArthur/tailwindcss-dark-mode/pull/34, fixes that by using the listener / observer feature of matchMedia.

JNavith avatar Aug 30 '20 20:08 JNavith

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/ejmaito/tailwindcss-multi-theme/ber6ew8lx
✅ Preview: https://tailwindcss-multi-theme-git-fork-jakenavith-master.ejmaito.vercel.app

vercel[bot] avatar Aug 30 '20 20:08 vercel[bot]

This pull request is being automatically deployed with Vercel (learn more). To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/ejmaito/tailwindcss-multi-theme/r9pjaqgkc ✅ Preview: https://tailwindcss-multi-theme-git-fork-jakenavith-master.ejmaito.vercel.app

By the way, you won't be able to see a difference on this automatically generated preview (very cool, by the way!) because you use Alpine code there instead of the prefers-dark script.

Similarly, because I don't know React, Vue, or Alpine, I can't update any of those examples (in the examples folder) to watch the system theme 😦 .

JNavith avatar Aug 30 '20 20:08 JNavith