dark-mode-listener

0.1.2 • Public • Published

Node.js Dark Mode Listener

A small library for listening to dark mode changes on macOS Mojave.

Installation

npm install --save dark-mode-listener

Usage

const DarkMode = require('dark-mode-listener')
 
DarkMode.on('change', (value) => {
  console.log(`We are now in ${value} mode`)
  //=> We are now in dark mode
})

The export of the module is an EventEmitter that will emit a change event whenever dark mode is toggled on or off, and initially when the module is loaded.

API

event: change

The change event is emitted whenever dark mode is toggled on or off, and initially when the module is loaded. The value is a single string that will read either 'light' or 'dark'.

.currentValue

Holds the current value, either 'light' or 'dark'. This property will be undefined until the first change event have been emitted.

.stop()

Stop listening for changes.

Implementation

This package ships with a small binary, dark-mode-listener, to listen to the changes.

Readme

Keywords

none

Package Sidebar

Install

npm i dark-mode-listener

Weekly Downloads

1

Version

0.1.2

License

MIT

Unpacked Size

9.79 MB

Total Files

6

Last publish

Collaborators

  • linusu