Package detail

@ant-design/fast-color

ant-design3.5mMIT3.0.0

fast and small color class

react, react-component, react-trigger, trigger

readme

@ant-design/fast-color

Fast color class.

NPM version npm download build status Test coverage bundle size dumi

Install

@ant-design/fast-color

Usage

import { FastColor } from '@ant-design/fast-color';

// input
new FastColor('#666'); // short hex
new FastColor('#66ccff'); // hex
new FastColor('#66ccffaa'); // hex with alpha
new FastColor('rgba(102, 204, 255, .5)'); // old css rgb syntax
new FastColor('rgb(102 204 255 / .5)'); // new css rgb syntax
new FastColor('hsl(270, 60, 40, .5)'); // old css hsl syntax, with or without unit
new FastColor('hsl(270deg 60% 40% / 50%)'); // new css hsl syntax, with or without unit
new FastColor({ r: 102, g: 204, b: 255, a: 0.5 }); // rgb object
new FastColor({ h: 270, s: 0.6, l: 0.4, a: 0.5 }); // hsl object
new FastColor({ h: 270, s: 0.6, v: 0.4, a: 0.5 }); // hsv object

// clone
const color = new FastColor('#66ccff');
const color2 = new FastColor(color); // clone via constructor
const color3 = color2.clone(); // call clone method

// output
color.toHexString(); // #66ccff
color.toRgb(); // Object { r: 102, g: 204, b: 255, a: 1 }
color.toRgbString(); // rgb(102,204,255)
color.toHsl(); // Object { h: 200, s: 0.6, l: 0.7, a: 1 }
color.toHslString(); // hsl(200,60%,70%)
color.toHsv(); // Object { h: 200, s: 0.6, v: 1, a: 1 }

Compatibility

浏览器 IE / Edge Firefox Chrome Safari Electron
支持版本
IE11, Edge

最近2个版本

最近2个版本

最近2个版本

最近2个版本

API

TODO

License

@ant-design/fast-color is released under the MIT license.

changelog

History


4.1.0 / 2020-05-08

  • upgrade rc-animate to 3.x

2.5.0 / 2018-06-05

  • support alignPoint

2.1.0 / 2017-10-16

  • add action contextMenu

2.0.0 / 2017-09-25

  • support React 16

1.11.0 / 2017-06-07

  • add es

1.9.0 / 2017-02-27

  • add getDocument prop

1.8.2 / 2017-02-24

  • change default container to absolute to fix scrollbar change problem

1.7.0 / 2016-07-18

  • use getContainerRenderMixin from 'rc-util'

1.6.0 / 2016-05-26

  • support popup as function

1.5.0 / 2016-05-26

  • add forcePopupAlign method

1.4.0 / 2016-04-06

  • support onPopupAlign

1.3.0 / 2016-03-25

  • support mask/maskTransitionName/zIndex

1.2.0 / 2016-03-01

  • add showAction/hideAction

1.1.0 / 2016-01-06

  • add root trigger node as parameter of getPopupContainer