# color-scheme-fallback

> color-scheme-change with legacy fallback way (using hash parameter)

Latest version **0.8.2** (published 2020-03-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install color-scheme-fallback
pnpm add color-scheme-fallback
yarn add color-scheme-fallback
bun add color-scheme-fallback
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.8.2 |
| Published | 2020-03-23 |
| First published | 2020-03-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=8.0.0 |
| Dependencies | 0 |
| Unpacked size | 13.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | pktcjswo |
| Keywords | dark mode, color scheme, prefers-color-scheme, light mode |

## Links

- npm: https://www.npmjs.com/package/color-scheme-fallback
- Homepage: https://github.com/pktcjswo/color-scheme-fallback#readme
- Issues: https://github.com/pktcjswo/color-scheme-fallback/issues
- npm.io page: https://npm.io/package/color-scheme-fallback

## Alternatives

- [postcss-color-hex-alpha](https://npm.io/package/postcss-color-hex-alpha.md) — 6.4M weekly downloads
- [randomcolor](https://npm.io/package/randomcolor.md) — 348.0K weekly downloads
- [bows](https://npm.io/package/bows.md) — 1.3K weekly downloads
- [ep_prefer_color_scheme](https://npm.io/package/ep_prefer_color_scheme.md) — 260 weekly downloads
- [coc-yank](https://npm.io/package/coc-yank.md) — 61 weekly downloads

## Recent versions

- 0.8.2 (latest) — 2020-03-23
- 0.8.1 — 2020-03-23
- 0.8.0 — 2020-03-22

## README

![Node.js Package](https://github.com/pktcjswo/color-scheme-fallback/workflows/Node.js%20Package/badge.svg?branch=master)

# 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
```bash
$ npm i --save color-scheme-fallback
```

## API
```js
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
})
```

---
_Source: https://npm.io/package/color-scheme-fallback · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
