Socket
Socket
Sign inDemoInstall

@antv/color-util

Package Overview
Dependencies
3
Maintainers
33
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @antv/color-util

A common util collection for antv projects


Version published
Weekly downloads
93K
increased by1.55%
Maintainers
33
Install size
376 kB
Created
Weekly downloads
 

Readme

Source

color-util

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

安装下载

tnpm i --save @antv/util

// 所有的 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']
    • 返回值是一个函数,可以传入百分百,返回函数
const grad = gradient(['red', 'blue']);
const color1 = grad(0.1);
const color2 = grad(0.2);
  • toRGB(color) : 将颜色转换成 RGB 的格式
import { toRGB } from '@antv/color-util';
toRGB('red');
toRGB('rgb(240, 240, 233)');

Keywords

FAQs

Last updated on 21 Dec 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc