npm.io
1.1.0 • Published 7 years ago

preferred-color-scheme

Licence
MIT
Version
1.1.0
Deps
0
Size
9 kB
Vulns
0
Weekly
0
Stars
2

preferred-color-scheme

Really small package exporting utility functions to read the user's preferred color scheme. It can be useful when trying to match web applications colors to macOS theme selection.

Installation and usage

yarn add preferred-color-scheme
npm install preferred-color-scheme
import { getPreferredColorScheme } from 'preferred-color-scheme';

const preferredColorScheme = getPreferredColorScheme();

API

getPreferredColorScheme

Calculate which ColorScheme is the user's preferred one

returns ColorScheme: either "dark", "ligh", or "no-preference"