- Supports four color spaces: sRGB, Display P3, CIELab and CIEXYZ with precise conversion between them.
- Zero dependencies
- Parser doesn’t rely on browsers to parse color strings and could be used in any environment.
- Understands all CSS colors and many more cool features!
In the terminal:
% npm install @snigos/color
Then in the module:
Color package consists of several perfectly tree-shakeable modules:
- sRGBColor class whos instances store vital information about the color in sRGB color space
- LabColor class that does the same for Lab color space
- XYZColor class that store information about the color in CIEXYZ color space
- contrast function: calculates, validates and generates color in given hue with desired target contrast
- mix and mixLab functions: well, they mix colors either in sRGB or Lab color space
You can only import and use functionality you need.