This project features a simple toggle switch that allows users to switch the theme of a web page between dark and light modes.
- Persistence: Remembers the user's previously set theme mode preference when the page loads.
- Visual Feedback: Indicator on the toggle switch depending on the current theme mode (Sun 🌞 and Moon 🌙).
- Responsive: Automatically hides the switch on mobile devices (below 768px).
- Storage: Saves the user's theme mode preference to local storage when changed.
You can directly use the code by adding it to your web page. You can determine if the dark mode is active by checking the classes of the body
tag.
Upon loading the page, you'll see a toggle switch on the top right corner. You can use this switch to change the theme mode between dark and light. CC0 1.0 Universal (CC0 1.0) Public Domain Dedication