How to make a website light/dark toggle with CSS & JS
Kevin Powell Kevin Powell
927K subscribers
120,332 views
0

 Published On Oct 23, 2019

A look at how to create a dark mode toggle switch using JS, which saves the person's preference in localStorage for the next time they visit.

Code from this video: https://codepen.io/kevinpowell/pen/EM...

///// Change to dark mode using a media query instead!    • Dark mode with a media query!  

---
Come and hangout, ask questions, suggest ideas, and meet some awesome people over in The Community:   / discord  

I have a newsletter! https://www.kevinpowell.co/newsletter

I've been working on some courses! Find out more: https://www.kevinpowell.co/courses

---

My Code Editor: VS Code - https://code.visualstudio.com/

How my browser refreshes when I save:    • How to automatically refresh your bro...  

---

Support me on Patreon:   / kevinpowell  

I'm on some other places on the internet too!

If you'd like a behind the scenes and previews of what's coming up on my YouTube channel, make sure to follow me on Instagram and Twitter.

Instagram:   / kevinpowell.co  
Twitter:   / kevinjpowell  
Codepen: https://codepen.io/kevinpowell/
Github: https://github.com/kevin-powell

show more

Share/Embed