@ant-design/fast-color
fast and small color class
Last updated 4 months ago by zombiej .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @ant-design/fast-color 
SYNC missed versions from official npm registry.

@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
IE / Edge
Firefox
Firefox
Chrome
Chrome
Safari
Safari
Electron
Electron
IE11, Edge last 2 versions last 2 versions last 2 versions last 2 versions

API

TODO

License

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

Current Tags

  • 2.0.6                                ...           latest (3 months ago)

16 Versions

  • 2.0.6                                ...           3 months ago
  • 2.0.5                                ...           3 months ago
  • 2.0.4                                ...           4 months ago
  • 2.0.3                                ...           4 months ago
  • 2.0.2                                ...           4 months ago
  • 2.0.1                                ...           4 months ago
  • 2.0.0                                ...           4 months ago
  • 1.3.0                                ...           4 months ago
  • 1.2.6                                ...           4 months ago
  • 1.2.5                                ...           4 months ago
  • 1.2.4                                ...           4 months ago
  • 1.2.3                                ...           4 months ago
  • 1.2.1                                ...           4 months ago
  • 1.2.0                                ...           4 months ago
  • 1.1.0                                ...           4 months ago
  • 1.0.0                                ...           5 months ago
Downloads
Total 2
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (1)
Dev Dependencies (14)

© 2010 - cnpmjs.org x YWFE | Home | YWFE