DEV Community

Discussion on: Use CSS to automatically enable dark mode in your web app based on system settings

theankitjais profile image
Ankit Jaiswal

It works BUT how to add toggling button?
*if it is in dark mode, toggle in light & vice versa?

mostafakheibary profile image
Mostafa Kheibary

you can just make class and after that with js add some toggle event listener on button
you can make it with css with toggle:checked and after that make the root color changes