Colore JS

Search documentation

Find a function or jump to a section.
v2.0.1

Entry points and exports

Colore has two package imports. Use colore-js for Color objects and theme work, and colore-js/fn for standalone operations.

colore-js

Use the root for the fluent API, parsing and validation, and higher-level workflows.

GroupRuntime exports
ConstructionColor, colore, default (Color)
Parsingparse, parseToSpace, detectFormat
ValidationisValidColor (use detectFormat to learn which format a valid string uses)
Higher-level workflowsaudit, ensureContrast, generateSystem, generateStates, categoricalColors
CSS variablesauditCssVariables, fixCssVariables, inspectCssTheme, applyThemeToCss, adjustCssVariables, tokenGroup
ErrorsColorError

Export formats (CSS variables, Tailwind v4, shadcn/ui, DTCG, JSON) are methods on the system that generateSystem returns, not separate functions.

import Color, { colore, ensureContrast } from 'colore-js';

const a = new Color('#2563eb');
const b = colore('#2563eb');
console.log(a.equals(b, 0)); // true
console.log(ensureContrast(a, '#ffffff').satisfied); // true

colore-js/fn

Use /fn for named standalone operations. Color transforms return CSS strings, and palettes return arrays of them. Parsers return numeric values. Workflows such as audit and generateSystem return typed results.

GroupRuntime exports
Parse and validateparse, parseToSpace, parseColorMix, detectFormat, isValidColor
Manipulation and outputlighten, darken, saturate, desaturate, adjustHue, grayscale, invert, complement, setAlpha, setOklch, mix, mixToCss, toHex, toRgb, toHsl, toOklab, toOklch, toCss
Harmony, scale, palettetriadic, scale, interpolate, palette, categoricalColors
Accessibility and distancecontrastRatio, contrastAPCA, ensureContrast, luminance, isReadable, bestTextColor, deltaE, deltaEOK, nearestNamed
Color-vision simulationsimulate
Advanced workflowsaudit, generateSystem

Design tokens

generateSystem(...).toDTCG() exports a DTCG 2025.10 document typed as DTCGDocument (exported from the package root).

Type-only exports

Each entry point also exposes TypeScript types appropriate to that surface. Import them with import type so they do not become runtime imports. See Types for the grouped index.