这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ Evaluate whether two colors have sufficient contrast to pass WCAG requirements.

Doesn't handle transparency as of yet.

### Installation
## Installation
```sh
npm i passes-wcag
```

### Usage
## Usage
```js
import {
passesWcagAaLargeText,
Expand All @@ -25,9 +25,23 @@ passesWcagAaLargeText('rgb(1, 1, 1)', 'rgb(250, 248, 247)') // true
passesWcagAaa('black', 'rgb(0, 0, 0)') // false
```

### Signature
## Signature
```
passesWcagAaLargeText(color1: string, color2: string) => boolean
passesWcagAa(color1: string, color2: string) => boolean
passesWcagAaa(color1: string, color2: string) => boolean
```

## Contributing
I appreciate your issues and PRs [on Github](https://github.com/misund/passes-wcag)!

### Testing
```
yarn build && yarn test
```

### Releasing
This project uses [np](https://github.com/sindresorhus/np).
1. Make sure your changes are in master
2. Run `yarn release`
3. Follow the interactive release guide
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"mocha": "mocha --require @babel/register",
"prepublish": "yarn build && yarn test",
"postpublish": "git push --tags",
"release": "np",
"test": "yarn lint && yarn mocha"
},
"repository": {
Expand Down Expand Up @@ -43,7 +44,8 @@
"eslint-plugin-import": "2.17.3",
"eslint-plugin-jsx-a11y": "6.1.2",
"eslint-plugin-react": "7.13.0",
"mocha": "5.2.0"
"mocha": "5.2.0",
"np": "5.0.2"
},
"dependencies": {
"get-contrast-ratio": "0.1.4"
Expand Down
Loading