DEV Community


Discussion on: Make a custom night mode toggle w/React & CSS Variables

tomayac profile image
Thomas Steiner

You could make this aware of the user's preference by defaulting the initial mode to the user's prefers-color-theme setting. See <dark-mode-toggle> for how I have dealt with this.

ninjasoards profile image
David Y Soards Author

I thought about doing this, but I kind of wanted to force people to hit the button initially. I feel like the transition makes the neon, flickering effect more fun. Good suggestion though, and nice repo - I gave you a ⭐️!

Forem Open with the Forem app