0.1.5 • Published 1 year ago

light-switch-bootstrap v0.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

💡 Light Switch for Bootstrap 5

Under the hood

Switching to dark mode is done by toggling HTML tags that includes -dark or -light as a class. Performed by DOM manipulation using JavaScript based on the default system theme. Local storage is used to save the choice under the name: lightSwitch

Installing

  • Download the latest release v0.1.5

  • Clone via git clone https://github.com/han109k/light-switch-bootstrap.git

  • Install with npm npm i light-switch-bootstrap

Usage

Add custom checkbox to your html file then reference the switch.js script:

<div class="form-check form-switch">
  <label class="form-check-label" for="lightSwitch"> Dark Mode </label>
  <input class="form-check-input" type="checkbox" id="lightSwitch" />
</div>

<script src="/node_modules/light-switch-bootstrap/switch.js"></script>

About Usage

Designed for the plain Bootstrap 5 theme. If you're using custom themes then, you will probably have to customize it for better results.

Example Implementation

Bootstrap 5 Demo

0.1.5

1 year ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

3 years ago

0.1.1

3 years ago