Elestia Open Source Ratings
5.7

d3-color

Reasonable, with limits. 5th of 7 color libraries.

d3-color is D3's small color module. It parses CSS colors and converts them between RGB, HSL, Lab, HCL and Cubehelix, and it has no dependencies. It is solid inside D3 visualizations. For new standalone color work, Culori or Color.js are better choices: d3-color still lacks OKLCH, CSS Color 4 parsing and gamut mapping.

Best for: D3 and data-visualization projects that need simple, reliable conversion between RGB, HSL, Lab and HCL, and nothing more.

WebsiteGitHubnpm

Scores

Overall5.7

How strongly do we recommend it for a new project today?

Claude Opus 5.5: 5.0, likely 4.0 to 6.0

It is a reliable, tiny module that is already present wherever D3 is. As a new choice for the category's job, though, it falls behind Culori and Color.js, because it lacks OKLCH, CSS Color 4 and gamut mapping and development has nearly stopped. Pick it only if you are already in D3 and need its color spaces.

GPT-6.2 Sol: 6.4, likely 5.3 to 7.5

d3-color remains a solid choice for new D3 charts that work with classic CSS colors and need Lab, LCh or Cubehelix. Culori is a better standalone choice for projects that need CSS Color 4 inputs and built-in mixing. The recent patch supports continued use, but slow feature development and uncertain direct adoption limit the recommendation.

Needed by many4.2

How many developers need a tool for this job?

Claude Opus 5.5: 4.0, likely 3.0 to 5.0

Few JS developers need to parse, convert and mix colors directly. d3-color's take leans toward data visualization and the D3 ecosystem, so it is narrower than general-purpose peers. It still runs on any runtime.

GPT-6.2 Sol: 4.4, likely 3.3 to 5.6

Programmatic color conversion serves charts, palette tools and editors, and d3-color can run without a framework. Its focus on classic CSS input makes it a narrower fit for current design tooling. The available surveys cover CSS users or visualization specialists, so the share of all JavaScript developers who need this API is uncertain.

Helps a lot5.7

How well does it do the job for those who need it?

Claude Opus 5.5: 5.0, likely 4.0 to 6.0

It does its core conversions correctly and its API is clean, and the ReDoS bug in the parser was fixed in 3.1.0. It lacks OKLab/OKLCH, CSS Color 4 syntax, gamut mapping, delta-E and contrast, so Culori and Color.js now do the same job clearly better. It ships no types of its own. AI agents know the API well because D3 is so widely used.

GPT-6.2 Sol: 6.3, likely 5.2 to 7.4

Version 3.1.1 has clear examples for conversion and formatting, and a third-party numerical check found close agreement on Cubehelix conversions. Culori handles modern CSS syntax and interpolation in one package, while d3-color needs d3-interpolate for mixing and a separate package for types. The feature gaps are clear, but evidence on end-to-end speed and coding-agent accuracy is limited.

Holds up over time5.4

Will it still be a good choice in two years?

Claude Opus 5.5: 5.0, likely 4.0 to 7.0

The D3 org and Observable keep it alive, and so much of the ecosystem depends on it that it will not vanish. Activity is minimal, though: one commit and one tooling-only release in the last year, long-open feature issues, and an unanswered security report. It is a safe bet to stay as it is, but not to gain modern color spaces.

GPT-6.2 Sol: 5.8, likely 4.5 to 7.1

D3 still depends on the module, and the November 2026 patch updated packaging and release tooling after a gap of more than four years. The repository recorded one commit in the past year, and the CSS Color 4 request has stayed open for years. Recharts documented build breakage from the earlier D3 move to ES modules, and the release history gives limited visibility into who else can publish fixes.

Used widely6.3

How many use it, and is that growing?

Claude Opus 5.5: 6.0, likely 5.0 to 7.0

Its 421M downloads in 4 weeks are the most in the category. Most of them come in transitively through d3-interpolate, d3-scale and chart libraries such as Recharts. Its download ratio of 6.4 is above the 4.1 median, but that mostly tracks D3's own spread rather than people choosing it directly. Its 133k dependent repos point to tens of thousands of direct users, fewer than color or colord have.

  • npm downloadsLast4Weeks: 421M now vs 66M a year ago, a ratio of about 6.4
  • dependents: 133,799 repos and 725 packages, against 2.38M for color and 935k for colord
  • github stars: 428 stars, the fewest among the peers
  • bluesky posts: No posts or HN stories about it directly

GPT-6.2 Sol: 6.5, likely 4.9 to 7.8

Four-week installs grew from 66 million to 421 million, a 6.37× increase against the catalog median of 4.1×. Ecosyste.ms found about 134,000 dependent repositories, more than for chroma.js and fewer than for colord, TinyColor or color. D3 and d3-interpolate install it automatically, so both the number of direct choices and their growth remain uncertain.

  • npm.downloadsLast4Weeks, npm.downloadsSame4WeeksYearAgo, medianDownloadsRatio: Install volume grew faster than the catalog median.
  • dependents.repos, dependents.packages, peers: 133,799 indexed repositories and 725 packages.
  • github.stars, hackerNews.stories, bluesky.posts: 428 stars and no matched Hacker News stories or Bluesky links.
  • npmjs.com/package/d3?activeTab=dependencies: Installing D3 pulls in d3-color.
  • github.com/d3/d3-interpolate/blob/main/package.json: Installing d3-interpolate also pulls it in.
Vouched for6.6

Who stands behind it being good?

Claude Opus 5.5: 6.0, likely 4.0 to 7.0

It ships inside D3, which major chart libraries and Observable run in production, and Culori says it builds on d3-color's ideas. Independent color-library comparisons in 2026 mostly leave it out or recommend Culori, Color.js or chroma.js instead. Its backing comes from D3's reputation rather than from standalone endorsements.

GPT-6.2 Sol: 7.1, likely 5.9 to 8.2

Vega's interpolation stack pulls in d3-color, and runZero lists the package in its shipped software. Independent numerical checks support its Cubehelix conversion, and visualization practitioners rate D3.js among their favorite tools. Most of the adoption and survey evidence concerns the wider D3 stack, so satisfaction with d3-color as a standalone library is harder to judge.

Safe7.1

How safe is it to depend on?

Claude Opus 5.5: 7.0, likely 5.0 to 8.0

It has no dependencies, uses the permissive ISC licence and now publishes through npm trusted publishing. Its one advisory, a high-severity ReDoS, was fixed in 3.1.0, but the fix was not backported to 1.x or 2.x, which many trees still pull in. Its Scorecard is low at 2.8, and an unverified prototype-pollution report has had no response.

GPT-6.2 Sol: 7.1, likely 5.9 to 8.3

The package has zero runtime dependencies, uses the permissive ISC licence and adopted npm trusted publishing in 3.1.1. The high-severity denial-of-service issue was fixed in 3.1.0, about nine months after Snyk published it, and the bundle shows no advisories in the past two years. The 2.8 OpenSSF Scorecard and weak checks for branch protection, review, dependency pinning and security policy leave uncertainty about release safeguards.

Good

  • It has no dependencies, it is tiny and tree-shakeable, and it is ISC-licensed.
  • Its API is simple and consistent for RGB, HSL, Lab, HCL and Cubehelix, and it plugs straight into d3-interpolate and d3-scale.
  • It is stable and mature, with almost no breaking changes since v3, and it is now published through npm trusted publishing.
  • Vast numbers of chart libraries install it through D3, so its behaviour is well known.

Bad

  • It has no OKLab or OKLCH and does not parse CSS Color 4 (issues #87 and #96 have been open for years).
  • It has no gamut mapping, delta-E or WCAG contrast helpers, all of which Culori and Color.js provide.
  • It ships no built-in TypeScript types; you need @types/d3-color from DefinitelyTyped.
  • Development is slow: the one 2026 release changed only tooling, and a prototype-pollution report from April 2026 has no response.

The numbers

npm downloads, 4 weeks
421M ×6.4 in a year
GitHub stars
428
Commits, 12 months
1
npm version
3.1.1 Nov 2026
Versions, 12 months
1
Advisories, 24 months
0 of 1 ever
OpenSSF Scorecard
2.8 out of 10, Nov 2026
Licence
ISC

Read on 21 November 2026 from GitHub (d3/d3-color), npm (d3-color), OSV and the OpenSSF Scorecard.

Color libraries

  1. 7.9Color.js
  2. 7.0colord
  3. 6.8Culori
  4. 6.6chroma.js
  5. 5.7d3-color
  6. 4.9color
  7. 3.9TinyColor
Compare all 7 on six scores