# What changed in chroma-js

> 16 changes in chroma-js 2 to 3 from its official release notes, upgrade guides and advisories: 8 breaking, 5 new APIs and options. Each one cited. Sources checked 2026-10-29. HTML: https://unstale.sh/npm/chroma-js/

To see which of these apply to a repository, run `npx @unstale/cli init` in it.

## chroma-js 3

### Breaking changes

- The domain function now returns all scaled positions rather than only the minimum and maximum. (3.2.0) — [release notes](https://github.com/gka/chroma.js/releases/tag/v3.2.0)
- color.css() now returns modern space-separated CSS colors instead of legacy comma-separated syntax. (3.0.0) — [release notes](https://github.com/gka/chroma.js/releases/tag/v3.0.0)
- The hsl2rgb conversion no longer rounds. (3.0.0) — [release notes](https://github.com/gka/chroma.js/releases/tag/v3.0.0)

### New APIs and options

- chroma.random accepts an rng argument, allowing callers to provide a random number generator. (3.1.4) — [release notes](https://github.com/gka/chroma.js/releases/tag/v3.1.4)
- CSS colors can now be exported and parsed in lab(), lch(), oklab(), and oklch() color spaces. (3.0.0) — [release notes](https://github.com/gka/chroma.js/releases/tag/v3.0.0)
- Sets the standard white reference point for the CIE Lab and CIE Lch color spaces. (3.0.0) — [release notes](https://github.com/gka/chroma.js/releases/tag/v3.0.0)

### Fixes and other changes

- The scale.domain implementation was fixed. (3.2.0) — [release notes](https://github.com/gka/chroma.js/releases/tag/v3.2.0)
- Repairs non-default imports. (3.0.0) — [release notes](https://github.com/gka/chroma.js/releases/tag/v3.0.0)
- OKLab now uses the W3C implementation. (3.0.0) — [release notes](https://github.com/gka/chroma.js/releases/tag/v3.0.0)

## chroma-js 2

### Breaking changes

- The default interpolation for average is now lrgb. (2.0.0) — [release notes](https://github.com/gka/chroma.js/blob/HEAD/CHANGELOG.md)
- When colors cannot be parsed correctly, chroma now throws Errors instead of silently failing with console.errors. (2.0.0) — [release notes](https://github.com/gka/chroma.js/blob/HEAD/CHANGELOG.md)
- HCG inputs now use [0..360,0..1,0..1] instead of [0..360,0..100,0..100], aligning with HSL. (2.0.0) — [release notes](https://github.com/gka/chroma.js/blob/HEAD/CHANGELOG.md)
- The default interpolation for interpolate is now lrgb. (2.0.0) — [release notes](https://github.com/gka/chroma.js/blob/HEAD/CHANGELOG.md)
- The default interpolation for mix is now lrgb. (2.0.0) — [release notes](https://github.com/gka/chroma.js/blob/HEAD/CHANGELOG.md)

### New APIs and options

- chroma.js was ported to ES6, allowing projects to import parts of chroma. (2.0.0) — [release notes](https://github.com/gka/chroma.js/blob/HEAD/CHANGELOG.md)
- Color conversion functions support object unpacking, such as passing {h,s,l} to hsl2rgb. (2.0.0) — [release notes](https://github.com/gka/chroma.js/blob/HEAD/CHANGELOG.md)
