darkdetector
v0.0.2
Published
[![Travis CI Build Status](https://img.shields.io/travis/com/Richienb/darkdetector/master.svg?style=for-the-badge)](https://travis-ci.com/Richienb/darkdetector) [![CodeFactor Score](https://www.codefactor.io/repository/github/Richienb/darkdetector/badge?s
Downloads
4
Readme
Dark Detector
Detect dark mode in any browser.
Importing
From your NodeJS application:
const DarkDetector = require("darkdetector")
From your web application:
<script src="https://unpkg.com/darkdetector/darkdetector.min.js"></script>
Usage
// Check if dark mode enabled
if (DarkDetector({
query: true, // Check for dark mode media query
highcontrast: false, // Check for white on black media query
bodyclass: false, // Check for class on body class
time: false // Check for night time
})) console.log("Dark mode is enabled.")