feat: use client-hints for theme#479
Conversation
|
Should we also add system theme mode, like we have in the epic stack example? |
|
I would definitely like to support system |
|
To be more specific:
Which approach do you prefer? I suggest the 2nd because it will fit perfectly with the current theme selector animation (the sunrise and moonrise animation). |
|
Yeah, but the 2nd functionality is also unclear. I definitely want the EpicStack's implementation. If you can come up with a nice improvement to the animation that's great. Or you can do a dropdown like the Epic Stack's profile button does. |
|
This is what the new animation looks like: Screen.Recording.2023-10-13.at.11.00.01.PM.mov |
kentcdodds
left a comment
There was a problem hiding this comment.
This is looking great! Just a few things.
Thanks a lot!
|
Thanks @kentcdodds, P.S.- Sorry it took so long; I was on vacation. |
kentcdodds
left a comment
There was a problem hiding this comment.
Awesome! Thank you! This is a huge help :)
|
Looks like there are typescript issues. I don't think they're related to your changes. The unified ecosystem can be a bit of a mess sometimes. They just had a v3 release so I'm guessing these are related to that :( |
a9e2acb to
d2ddd4d
Compare
|
Thank you so much for making this contribution. The fact my website didn't have a system mode really bugged me and I never liked my theming hacks either. I'm definitely happier with this now :) Thanks! |
| })(); | ||
| ` | ||
|
|
||
| function handleDarkAndLightModeEls() { |
Use Client Hints polyfill from The Epic Stack to get the user's theme preference.
Ref: https://github.com/epicweb-dev/epic-stack/blob/main/docs/client-hints.md
Ref: https://x.com/kentcdodds/status/1711082060046373174