1.0.0-rc.3 โข Published 4 years ago
@color2k/node v1.0.0-rc.3
color2k ยท
a color parsing and manipulation lib served in 2kB or less (1.4kB to be more precise)
color2k is a color parsing and manipulation library with the objective of keeping the bundle size as small as possible.
The bundle size is currently 1.4kB
Size comparison
lib | size | link |
---|---|---|
polished | 11.2kB | repo |
chroma-js | 13.7kB | repo |
color | 7.6kB | repo |
tinycolor2 | 5kB | repo |
color2k | 1.4kB | ๐ |
Installation
npm i --save color2k
If you need to server-side render any colors, you also need to install the node/ssr compatibility package.
# only needed in SSR environments (e.g. gatsby, next.js)
npm i --save @color2k/node
Usage
import { darken, transparentize } from 'color2k';
// e.g.
darken('blue', 0.1);
transparentize('red', 0.5);
How so small?
There are two secrets that keep this lib especially small:
- defer to the browser to parse colors via canvas
- small API footprint ๐คทโโ๏ธ
Credits
Heavy credits goes to polished.js and sass. Much of the implementation of this lib is copied from polished!
API and Documentation
1.0.0-rc.3
4 years ago
0.0.0-17a9eb32d
4 years ago
1.0.0-rc.1
4 years ago
1.0.0-rc.2
4 years ago
0.0.0-857ea0bc2
4 years ago
0.0.0-59add4b7c
4 years ago
0.0.0-2a7e65b00
4 years ago