# mourning-mode

> 哀悼模式，在指定日期自动使网页变黑白

Latest version **1.1.0** (published 2022-11-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install mourning-mode
pnpm add mourning-mode
yarn add mourning-mode
bun add mourning-mode
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2022-11-30 |
| First published | 2021-12-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=12 |
| Dependencies | 0 |
| Unpacked size | 8.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | CaoMeiYouRen |
| Maintainers | cao-mei-you-ren |

## Links

- npm: https://www.npmjs.com/package/mourning-mode
- npm.io page: https://npm.io/package/mourning-mode

## Recent versions

- 1.1.0 (latest) — 2022-11-30
- 1.0.1 — 2021-12-13
- 1.0.0 — 2021-12-13

## README

# 哀悼模式

哀悼模式，在指定日期自动使网页变黑白

## 安装

```sh
npm i mourning-mode
```
## 使用

```typescript
// 模块化工程
// cjs 版本
require('mourning-mode') // index.js
// esm 版本
import 'mourning-mode' // index.esm.js

```

```html
<!-- 浏览器端 非 esm 版本 index.browser.js -->
<script src="./index.browser.js">
```

```html
<!-- 浏览器端 使用 CDN -->
<script src="https://cdn.jsdelivr.net/npm/mourning-mode@latest/dist/index.browser.min.js"></script>
```

使用后会在以下日期自动启用哀悼模式

```ts
const dateList = [
    '7/7', // 七七事变
    '9/18', // 九一八事变
    '11/30', // 长者祭日
    '12/13', // 国家公祭日
]
```

## 原理

```tsx
document.body.style.filter = 'grayscale(1)'
```

## 配置

```ts
// 修改全局变量 MOURNING_MODEDATE_LIST 即可
 window.MOURNING_MODEDATE_LIST = [
     '11/30'
]
```

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