DEV Community

Discussion on: Create A Dark/Light Mode Switch with CSS Variables

Collapse
 
feldev profile image
Félix Paradis • Edited

Just added mine over at felixparadis.com :)

Quick note about accessibility though:
If you just display:none; your input, you're making it unaccessible through keyboard navigation.
Just hide it behind the label instead and everyone can toggle 🎉
Then add aria-label="Switch visual theme" to your input and blind users can know what's it about.

Collapse
 
codemonster240 profile image
Andrew Burch

Yours must be the coolest dark/light button I've seen! I suppose you used custom CSS other than the one in the tutorial?