Socket
Book a DemoInstallSign in
Socket

dark-mode

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dark-mode

Control the macOS dark mode

latest
Source
npmnpm
Version
5.0.0
Version published
Maintainers
1
Created
Source

node-dark-mode

Control the macOS dark mode

Requires macOS 10.10 or later.

Install

npm install dark-mode

Usage

import darkMode from 'dark-mode';

await darkMode.enable();
console.log('Enabled dark mode');

await darkMode.toggle();
console.log('Toggled between dark and light mode');

API

darkMode

All the methods return a Promise, except for .watch().

.enable()

.disable()

.toggle(force?)

force

Type: boolean

Force a specific mode. true for dark and false for light.

.isEnabled()

Returns a Promise<boolean> of whether you're in dark mode.

.watch(callback)

Watch for dark mode changes.

callback

Type: (isDarkMode: boolean) => void

Function to call when dark mode changes.

Returns a watcher object with a stop method.

import darkMode from 'dark-mode';

const watcher = darkMode.watch(isDark => {
	console.log('Dark mode is now:', isDark ? 'enabled' : 'disabled');
});

// Later, stop watching
watcher.stop();
  • dark-mode-cli - CLI for this module
  • alfred-dark-mode - Alfred workflow

Keywords

macos

FAQs

Package last updated on 09 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts