LunaJS is a lightweight vanilla JS library to add dark mode on your website. This script works in all modern browsers.
⚠️ Under Construction Work in Progress. Nothing to use yet :(
You can use npm to install it or include the web script on the header of your page via CDN.
Install it with npm
npm install --save lunajs
OR include the script at the bottom of the page before the closing body tag
<script src="">
As alternative you can download the latest release from this repo and include the files from the dist folder.
<script src="">
CSS is used for some basic styling
<link rel="stylesheet" href="">
OR If you installed it with npm and use sass you might try import the styles from
@import 'lunajs/src/sass/main.scss';
Initialize the script at the bottom of the page before the closing body tag
<script>
lunajs.init({
lunaSelector: '.switch',
});
</script>
//Where to render the dark mode switch
lunaSelector: '.switch',
//Option
luna