
A tiny JavaScript & CSS implementation of the trending dark mode theme for Bootstrap 4 framework.
It saves user preference to the browser’s local storage as other dark mode plugins & scripts. jQuery and Bootstrap 4’s JS are OPTIONAL.
How to use it:
1. Load the stylesheet darktheme.css after Bootstrap’s stylesheet.
<link rel="stylesheet" href="darktheme.css" />
2. Load the core JavaScript theme.js right before the closing body tag.
<script src="theme.js"></script>
3. Load the darkswitch.js script on the webpage where you’d like to show the dark mode toggle switch. That’s it.
<script src="darkswitch.js"></script>
Changelog:
v0.7.0 (10/13/2020)
- Added .bg-darkmode-black as an opposite for .bg-white.
- Added support for data-theme=”auto”, which will automatically apply dark mode dependending on user agent preference.
- Improved table border colors.
- Improved horizontal rule (<hr>) color.
The post Dark Mode Switcher For Bootstrap 4 appeared first on CSS Script.