Skip to content

A responsive toggle switch for transitioning between dark and light modes on web pages, with user preferences saved to local storage.

Notifications You must be signed in to change notification settings

dogukansahil/ToggleSwitch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Toggle Switch: Dark and Light Mode Transition

This project features a simple toggle switch that allows users to switch the theme of a web page between dark and light modes.

Features

  • 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.

Usage

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.

Preview

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

About

A responsive toggle switch for transitioning between dark and light modes on web pages, with user preferences saved to local storage.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages