Skip to content

Instantly share code, notes, and snippets.

@hahwul
Created December 30, 2020 04:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hahwul/008a9249afc2918cc1836dedccb3dc0c to your computer and use it in GitHub Desktop.
Save hahwul/008a9249afc2918cc1836dedccb3dc0c to your computer and use it in GitHub Desktop.
Darkmode with js
// Included this js
// <script src="https://cdn.jsdelivr.net/npm/darkmode-js@1.5.7/lib/darkmode-js.min.js"></script>
const options = {
bottom: '64px', // default: '32px'
right: 'unset', // default: '32px'
left: '32px', // default: 'unset'
time: '0.5s', // default: '0.3s'
mixColor: '#fff', // default: '#fff'
backgroundColor: '#fff', // default: '#fff'
buttonColorDark: '#100f2c', // default: '#100f2c'
buttonColorLight: '#fff', // default: '#fff'
saveInCookies: false, // default: true,
label: '🌓', // default: ''
autoMatchOsTheme: true // default: true
}
const darkmode = new Darkmode(options);
darkmode.showWidget();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment