DEV Community

Discussion on: How to add dark mode functionality with React Hooks

Collapse
 
waylonwalker profile image
Waylon Walker

👏 Thanks for sharing.

I am redesigning waylonwalker.com. The current redesign is dark. I might consider light and dark like you have. I like how you put the preference in localstorage.

What are your thoughts on the newprefers-color-scheme to tap into the users preference set in their os?

Collapse
 
amanhimself profile image
Aman Mittal

Thanks for reading it Waylon 🙌

The reason I used localStorage because I didn't know about prefers-color-scheme at the time of writing this post. I will have to try in practice. Hit me up, if you use this new syntax, seems legit as you can define it using media queries. :)

Collapse
 
waylonwalker profile image
Waylon Walker

I actually think that giving users the ability to change it in local storage like you have is still very good, but adding prefers-color-scheme as the first default would be best.