Color.js

Color conversion & manipulation library by the editors of the CSS Color spe...

README


Color.js: Let’s get serious about color Netlify Status npm



Features:

- Color space agnostic: Each color object is basically a list of coords and a color space reference. Operations are color space agnostic.
Modules for a wide variety of color spaces,
including Lab/LCh, OKLab/OKLCh,
sRGB and friends (HSL/HSV/HWB), Display P3,
Jzazbz, REC.2100 and many more.- **Doesn't gloss over color science**: Actual gamut mapping instead of naïve clipping,multiple DeltaE methods (76, CMC, 2000, Jz),multiple chromatic adaptation methods (von Kries, Bradford, CAT02, CAT16),
all with sensible defaults
- **Up to date with CSS Color 4**: Every CSS Color 4 format & color space supported for both input and output, whether your browser supports it or not.
- Readable, object-oriented API: Color objects for multiple operations on the same color, and static Color.something() functions for one-off calculations
- **Modular & Extensible**: Use only what you need, or a bundle. Client-side or Node. Deep extensibility with hooks.

- **Fast & efficient**: Procedural, tree-shakeable API available for performance sensitive tasks and reduced bundle size


Installation


Install via npm:

  1. ```
  2. npm install colorjs.io
  3. ```

For quick experiments, you can just import Color.js directly from the CDN with all modules included:

  1. ``` js
  2. import Color from "https://colorjs.io/dist/color.js";
  3. ```

You can also import specific modules:

  1. ``` js
  2. import Color from "https://colorjs.io/src/color.js";
  3. import p3 from "https://colorjs.io/src/spaces/p3.js";
  4. import rec2020 from "https://colorjs.io/src/spaces/rec2020.js";
  5. import deltaE200 from "https://colorjs.io/src/deltaE/deltaE2000.js";
  6. ```

Warning: To use `import` statements in a browser, your `