0.8.2 • Published 4 years ago
color-scheme-fallback v0.8.2
color-scheme-fallback
color-scheme-change with legacy fallback way (using hash parameter)
How we can turn on/off dark mode on some legacy device environments?
As an alternative way, it checks hash value, (e.g. '#?drkmd=y'), updates the color scheme, and stores the value for later visit.
Programmatically, you will be able to force-change media query accordingly.
install
$ npm i --save color-scheme-fallback
API
new ColorSchemeFallback({
onChange: (scheme) => {}, // callback function when color scheme has changed
storeScheme: true // true/false
hashFlag: 'darkmode', // which name to watch for color scheme (default: drkmd)
nativeFirst: true // false, if you want to set only by manually using hashFlag
})