Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

darkify-js

emrocode28MIT1.1.5TypeScript support: included

A simple dark mode toggle library

dark mode, light mode, theme toggle, dark theme, color scheme, theme switcher, night mode, automatic theme

readme

Darkify JS

Run tests

🌚 A simple dark mode toggle library that makes it easy to implement dark mode on your website without additional configuration

Please make sure to read the Wiki for detailed documentation and examples

📦 Installation

Use npm or any other package manager:

npm install darkify-js

⚙️ Setup

// main.js
import Darkify from 'darkify-js';

const options = {
  autoMatchTheme: true,
};

// autoMatchTheme: default is true
// useLocalStorage: default is true
// useSessionStorage: default is false
// useColorScheme: default is ['#ffffff', '#000000']

new Darkify('#element', options);