Colore and chroma.js compared
chroma.js converts every color to sRGB as soon as it reads it. Some of Tailwind CSS v4's default colors sit outside sRGB, so chroma.js changes them on the way in, and it can't parse Display P3 colors at all. Colore keeps those colors as they are. It also repairs contrast and builds light and dark themes from one brand color, and it's written in TypeScript with its own types, where chroma.js needs @types/chroma-js.
The outputs come from chroma-js 3.3.0 and colore-js 2.0.1, run on December 3, 2026.
npm install colore-js
chroma.js keeps colors as sRGB
A color outside sRGB loses its extra range when chroma.js parses it, and chroma.js doesn't report the change. Tailwind CSS v4's green-500 is one of those colors:
import chroma from 'chroma-js';
const green = chroma('oklch(72.3% 0.219 149.579)');
green.css('oklch'); // 'oklch(72.89% 0.21 147.82deg)'
green.clipped(); // false
chroma('color(display-p3 1 0 0)'); // throws "unknown format"
Writing the color back gives a different lightness, chroma and hue than the one you read. Colore keeps the original value. You choose when to bring it into sRGB, and how:
import { colore } from 'colore-js';
const green = colore('oklch(72.3% 0.219 149.579)');
green.isInGamut('srgb'); // false
green.oklch(); // 'oklch(0.72300 0.21900 149.58)'
green.toString(); // 'color(display-p3 0.30873 0.77475 0.37431)'
green.hex(); // '#00c950', clipped
green.toGamut('srgb').hex(); // '#00c950', gamut-mapped
colore('color(display-p3 1 0 0)').toString(); // 'color(display-p3 1.00000 0.00000 0.00000)'
For this green, clipping and gamut mapping give the same hex. For colors further outside sRGB they don't: oklch(0.7 0.3 150) clips to #00cb00 and maps to #00c248. chroma.js gives #00cb00 with no way to choose. See Gamut and CSS output for how Colore picks a format.
Five tasks in both libraries
Convert hex to OKLCH
chroma('#2563eb').css('oklch'); // 'oklch(54.61% 0.22 262.88deg)'
toOklch('#2563eb'); // 'oklch(0.54615 0.21521 262.88)'
Both give the same color, and Colore writes more precision.
Lighten and darken
chroma('#2563eb').brighten(1).hex(); // '#6f90ff'
chroma('#2563eb').darken(1).hex(); // '#003ab8'
lighten('#2563eb', 10); // '#3272fb'
darken('#2563eb', 10); // '#1451d8'
chroma.js moves Lab lightness by a fixed 18 units per step, and Lab pulls blues toward violet: brighten(1) moves this blue's OKLCH hue from 262.9 to 269.1 and its chroma from 0.215 to 0.168. Colore moves OKLCH lightness by a percentage and keeps hue 262.8 and chroma 0.215, which suits small steps such as hover colors. The two amounts don't translate one to one.
Mix two colors
chroma.mix('#2563eb', '#facc15', 0.5, 'oklab').hex(); // '#90a3ad'
mix('#2563eb', '#facc15', 0.5); // '#90a3ad'
Same result. Colore mixes in OKLab unless you pass another space. chroma.js defaults to linear RGB, so pass 'oklab' to it to match.
Build a scale
chroma.scale(['#2563eb', '#facc15']).mode('oklab').colors(5);
// ['#2563eb', '#5b87cf', '#90a3ad', '#c5b97f', '#facc15']
scale('#2563eb', '#facc15', { steps: 5 });
// ['#2563eb', '#5b87cf', '#90a3ad', '#c5b97f', '#facc15']
Same result, so OKLab scales you built with chroma.js keep their colors when you switch. For data maps, chroma.js goes further: chroma.scale('YlGnBu').domain([0, 100]).classes(5) maps values to classed colors from a ColorBrewer palette. Colore has no domain mapping or ColorBrewer palettes. Colore's palette builds 50 to 950 UI shades from one color instead, and categoricalColors picks distinct series colors for charts.
Check and fix contrast
chroma.contrast('#2563eb', '#ffffff'); // 5.168555560022562
chroma.contrastAPCA('#ffffff', '#2563eb'); // -80.24787933740542
contrastRatio('#2563eb', '#ffffff'); // 5.168555560022562
contrastAPCA('#ffffff', '#2563eb'); // 80.24787933740541
Both measure WCAG 2 and APCA. chroma.js returns the signed APCA value and Colore returns its magnitude. When a pair fails, Colore can repair it, and chroma.js has no equivalent:
ensureContrast('#777777', '#ffffff');
// { color: '#767676', satisfied: true, iterations: 1 }
ensureContrast moves the color as little as it can to reach the target.
The Colore calls above import from colore-js/fn:
import { contrastAPCA, contrastRatio, darken, ensureContrast, lighten, mix, scale, toOklch } from 'colore-js/fn';
What Colore adds for interfaces
generateSystem builds light and dark themes from one brand color, with text colors that pass contrast, and exports them for shadcn/ui, Tailwind CSS v4, CSS variables or design tokens. applyThemeToCss and the CLI update the theme file a project already has.
When chroma.js is the better choice
chroma.js has been a go-to library for data visualization for over a decade. Pick it when you map numbers to colors: scales with domains and classes, bezier interpolation and the ColorBrewer palettes. If your colors all come in as hex and stay in sRGB, its parsing limits won't affect you.
As a whole package it's smaller: 16.7 kB gzipped (bundlephobia), against 39 KiB for all of Colore's root exports. Colore's functions import separately, though. toHex alone from colore-js/fn is about 10 KiB gzipped and ensureContrast about 14 KiB, both under chroma.js's full size. The Color class is about 18 KiB and generateSystem about 33 KiB (measurements).
When Colore is the better choice
Pick Colore when your colors come from modern CSS, such as Tailwind CSS v4 or shadcn/ui themes, and you need them back unchanged. Pick it too when text has to pass contrast checks and you want failing colors fixed for you, or when you want a full light and dark theme from one brand color instead of building one by hand. You can try that with your own color in the theme generator.