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.
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.
- github.com/d3/d3-color/issues/87: No modern perceptual color spaces
- peers Color.js commitsLastYear: 188 commits for Color.js vs 1 for d3-color
- raw.githubusercontent.com/colorjs/color-space/HEAD/docs/library-comparison.md: Peers offer broader features
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.
- d3js.org/d3-color: Well-documented conversion API geared to D3 color workflows.
- culorijs.org: A peer covers modern formats and mixing in one package.
- github.com/d3/d3-color/releases/tag/v3.1.1: The current release focused on tooling and packaging.
- github.com/d3/d3-color/issues/96: Modern CSS syntax support remains open.
- github.commitsLastYear, dependents.repos: Low development activity alongside substantial indexed use.
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.
- github description: Covers RGB, HSL, Cubehelix and CIELAB color spaces
- pkgpulse.com/blog/culori-vs-chroma-js-vs-tinycolor2-color-manipulation-javascript-2026: The category splits into design-system work and data-viz work
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.
- d3js.org/d3-color: Standalone color representations and classic CSS parsing.
- 2025.stateofcss.com/en-US/features: Developers report using newer CSS color features.
- datavisualizationsociety.org/dvs-plus/soti-report-2025: D3.js ranks among frequently used and enjoyed visualization tools.
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.
- github.com/d3/d3-color/issues/87: The OKLab/OKLCH request has been open since 2020 with no maintainer decision; Tailwind's OKLCH palette cannot be parsed
- github.com/d3/d3-color/issues: Open requests for CSS Color 4, HWB, linear RGB, XYZ and gamut clamping
- raw.githubusercontent.com/colorjs/color-space/HEAD/docs/library-comparison.md: Peers offer 30 to 51 color spaces and gamut mapping
- npm hasTypes: No bundled TypeScript types
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.
- d3js.org/d3-color: Documents supported syntax, conversions, formatting and rounding.
- github.com/colorjs/color-space/blob/master/docs/formula-verification.md: Third-party Cubehelix comparison agreed closely in both directions.
- d3js.org/d3-interpolate/color: The companion package provides color mixing.
- culorijs.org: Culori includes CSS Color 4 support, interpolation and blending.
- stackoverflow.com/questions/78974637/typescript-error-d3-rgbcolor-not-having-r-g-b-properties: A user ran into the parser's RGB-or-HSL return type.
- npm.hasTypes: No bundled TypeScript declarations.
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.
- github commitsLastYear: 1 commit and 1 release in the last year
- github.com/d3/d3-color/releases: v3.1.1 changed only tooling: pnpm, vitest, trusted publishing, ESM bundle
- scorecard Maintained: Maintained check scored 0
- github.com/d3/d3-color/issues/123: An April 2026 security report has no response
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.
- github.commitsLastYear, github.releasesLastYear: One commit and one release in the past year.
- github.com/d3/d3-color/releases: The November 2026 patch followed the March 2022 release.
- github.com/d3/d3-color/issues/96: Long-running CSS Color 4 request has no assigned milestone.
- github.com/recharts/recharts/wiki/Home/e1215d20a9317a9c3d17b995c6bed538c2e442df: Recharts reverted an earlier D3 upgrade after consumer build failures.
- npmjs.com/package/d3?activeTab=dependencies: The current D3 umbrella package still depends on d3-color.
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.
- github.com/evercoder/culori: Culori says it builds on d3-color and d3-interpolate
- pkgpulse.com/blog/culori-vs-chroma-js-vs-tinycolor2-color-manipulation-javascript-2026: A 2026 comparison does not mention d3-color
- d3js.org/d3-interpolate/color: D3's color interpolators are built on d3-color
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.
- raw.githubusercontent.com/vega/vega/main/packages/vega-scale/package.json: Vega scales rely on d3-interpolate.
- github.com/d3/d3-interpolate/blob/main/package.json: d3-interpolate declares d3-color as a dependency.
- help.runzero.com/docs/runzero-bom.pdf: runZero lists d3-color 3.1.0 in its software bill of materials.
- github.com/colorjs/color-space/blob/master/docs/formula-verification.md: External numerical comparison supports Cubehelix conversion.
- datavisualizationsociety.org/dvs-plus/soti-report-2025: Eleven percent of respondents named D3.js among their favorites.
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.
- github.com/advisories/GHSA-36jr-mh4h-2g58: ReDoS affects versions below 3.1.0; patched in 3.1.0
- github.com/d3/d3-color/issues: Requests to backport the fix to 1.x and 2.x are still open
- scorecard score: 2.8, with no branch protection, security policy or SAST
- npm dependencies: 0 dependencies
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.
- npm.dependencies, npm.license, advisories.last24Months: Zero runtime dependencies, ISC licence and no recent advisories.
- github.com/d3/d3-color/releases/tag/v3.1.1: The current patch adopted npm trusted publishing.
- github.com/advisories/GHSA-36jr-mh4h-2g58: The high-severity parser issue was patched in 3.1.0.
- security.snyk.io/vuln/SNYK-JS-D3COLOR-1076592: Snyk published the advisory in July 2021.
- github.com/d3/d3-color/releases/tag/v3.1.0: The parser fix shipped in March 2022.
- scorecard.score, scorecard.checks: 2.8 overall with weak review and several missing 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.