incognito-theme-changer
v1.0.0
Published
A simple dark/light theme toggle with localStorage support
Downloads
4
Maintainers
Readme
Theme Toggler
A simple dark/light theme changer with localStorage support.
Installation
npm install incognito-theme-changerUsage
Simply add a button with id theme-toggle attribute:
//Create a button with id theme-toggle
<button id="theme-toggle">Toggle Theme</button>
Then, import the script and CSS:
import 'theme-toggler';
import 'theme-toggler/styles/theme-toggler.css';
// Attach the event listener to the button
const themeToggleButton = document.getElementById('theme-toggle');
themeToggleButton.addEventListener('click', () => {
// Toggle the theme when the button is clicked
ThemeToggler.toggleTheme();
});
License
This project is licensed under the MIT License - see the LICENSE file for details.
