colore-js
A zero-dependency color toolkit for conversion, manipulation, harmony generation, parsing, and contrast analysis.
For design systems and theming that need color to stay accurate across formats.
npm install colore-jsColor as a value
Colore treats a color as a value rather than a string: parse it from any supported format, convert it without losing the components, manipulate it predictably, generate a palette around it, and measure it for contrast. The full surface is one import with nothing underneath it.
Check a foreground and background
A contrast check between white and black returns a ratio of 21:1. The result also includes the accessibility level reported by the library.
import { getContrastRatio } from 'colore-js';
const contrast = getContrastRatio('#ffffff', '#000000');
console.log(contrast.ratio); // 21Monochromatic and complement
The two simplest harmonies it generates: one hue stepped through lightness, and the same hue rotated 180°.
Monochromatic
Complement
What it does
Convert
34 functionshex and hex-alpha, rgb and rgba, hsl and hsla, hsv, lab, lch, xyz, cmyk and named colors, all cross-converted.
Manipulate
8 functionsLighten, darken, saturate, desaturate, invert, blend, enhance, and set alpha.
Generate
7 functionsComplementary, analogous, triadic, tetradic and monochromatic harmonies, plus interpolated scales and random colors.
Analyse
12 functionsContrast ratio and relative luminance for accessibility work, plus ten format validators.
Size and CSS variables
No dependencies, and around 10 KB gzipped. It also reads and writes CSS custom properties directly, so a palette computed at runtime can go straight into the page without a serialization step in between.