Color.js

colorjs.io ↗

Convert colours between spaces and control their CSS output.

SI Score
80/100
Pricing
Open Source AI reading, not confirmed
Free plan
Yes AI reading, not confirmed
Sign-up required
Not confirmed

Ask SI about Color.js

Answers use saved listing facts and recorded sources.
Homepage screenshot
Screenshot of the Color.js homepage

What it does

Color.js is a JavaScript colour library for browser and Node projects. It handles colour spaces including sRGB, Display P3, Lab and OKLCH, with conversion, comparison and interpolation tools.

Install colorjs.io or import its hosted module. Create a Color object from a CSS string or a colour space and coordinates, then convert it to the space needed by the application.

The output controls select a CSS format such as RGB or hex. This is separate from changing the stored coordinates: conversion preserves out-of-range values, while string output normally maps them into a displayable range. Gamut is the range of colours a space can reproduce.

Call toGamut() when the coordinates themselves must fit that range. It modifies the object, so clone first if the original must remain available. The mapping method can also be chosen explicitly.

Color.js uses the MIT licence, which permits adaptation and redistribution with its notices retained.

Strengths

  • Object-oriented and selective procedural imports suit different application structures.

Watch out for

  • Gamut mapping can discard colour information and can modify the working object.

Best for

  • Developers handling wide-gamut colours and CSS output

Sources