# @antv/color-util

> A common util collection for antv projects

Latest version **2.0.6** (published 2020-12-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install @antv/color-util
pnpm add @antv/color-util
yarn add @antv/color-util
bun add @antv/color-util
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.0.6 |
| Published | 2020-12-21 |
| First published | 2019-04-09 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 24.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 72 |
| Author | https://github.com/orgs/antvis/people |
| Maintainers | elaine.q.10, sakuya223, leungwensen, dori, simaq, dxq613, lzxue, army8735, atool, baizn, dengfuping, neoddish, jeffy2012, zqlu, afc163, pomelo-nwu, kopiluwaky, ccnuzindex, panyuqi, bubkoo, zengyue, kasmine, wufenfen92, boyu.zlj, l1ud0ngq1, newbyvector, winniexing, chenluli, kn9117, xdddst, semious2020, esora, nadia_liu |
| Keywords | util, antv, g |

## Links

- npm: https://www.npmjs.com/package/@antv/color-util
- Repository: https://github.com/antvis/util
- Homepage: https://github.com/antvis/util#readme
- Issues: https://github.com/antvis/util/issues
- npm.io page: https://npm.io/package/@antv/color-util

## Dependencies (2)

- [tslib](https://npm.io/package/tslib.md) ^2.0.3
- [@antv/util](https://npm.io/package/@antv/util.md) ^2.0.9

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 2.0.6 (latest) — 2020-12-21
- 2.0.5 — 2020-05-07
- 2.0.4 — 2020-03-11
- 2.0.3 — 2020-02-18
- 2.0.2 — 2020-01-09
- 2.0.0 — 2019-04-09

## README

# color-util

> 为 `antv` 开发的轻量级工具方法库。


## 安装下载

> tnpm i --save @antv/util

```js
// 所有的 api 是都这么引入，名字不同而已
import { gradient } from '@antv/color-util';

const grad = gradient(['red', 'blue']);
const color1 = grad(0.1);
const color2 = grad(0.2);

```


## API 文档

> 目前使用到的、且推荐使用的 API 文档，不在文档内的不建议使用。
* rgb2arr('#ffeedd') 将 rgb 转换成 16 进制的数组
* gradient(colors) ： 'Function' 渐变色计算
	+ colors ： 颜色的数组，例如 ['red', 'blue']
	+ 返回值是一个函数，可以传入百分百，返回函数
 ```js
const grad = gradient(['red', 'blue']);
const color1 = grad(0.1);
const color2 = grad(0.2);
 ```
* toRGB(color) : 将颜色转换成 RGB 的格式

```js
import { toRGB } from '@antv/color-util';
toRGB('red');
toRGB('rgb(240, 240, 233)');
```

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