Back to Explore

d3/d3-color

GitHub
1 watchersOpen source

Last release:

d3-color is a JavaScript module for working with colors in multiple color spaces, including RGB, HSL, Cubehelix, and CIELAB. It provides representations plus tools to specify, convert, and manipulate colors, and it can be used alongside d3-interpolate for color interpolation.

Project status

  • Maintenance/active upkeep: Based on the provided release and upstream push data, the project looks mostly quiet or in maintenance mode. The last tagged update shown is v3.1.0 on 2022-03-28, and there have been no corresponding recent update entries after that, despite an upstream push on 2024-02-03.
  • Apparent update cadence: Updates appear infrequent, with multi-year gaps between the major change points shown (2021-06, 2022-03). Relative to 2026-10-02, that suggests cadence is currently low.

AI summary generated

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v3.1.0

    Release v3.1.0 adds new clamping utilities for RGB and HSL colors, and introduces a new hex output format with alpha (#RRGGBBAA) via formatHex8. It also fixes parsing issues, including a catastrophic backtracking problem and incorrect clamping behavior in formatHsl.

    SecurityFeatures
  • v3.0.1

    Release v3.0.1 focuses on making the build output reproducible. The change modifies the Rollup UMD banner generation to remove non-deterministic data (like the current year) and instead derives copyright text from the LICENSE file.

  • v3.0.0

    v3.0.0 primarily moves d3-color to an ES module package setup (package.json type: module) and updates the project to run on Node.js 12+. The diff also shows broader packaging and tooling changes, including a new package.json exports map, CI workflow additions, and substantial test/toolchain migrations to ESM-friendly setups.

    BreakingFeatures
  • v1.4.1

    v1.4.1 fixes parsing of 4- and 8-digit hexadecimal colors that include an alpha channel. The code change ensures transparent hex values are handled correctly and new tests were added to cover fully transparent (achromatic) inputs.

    Breaking
  • v2.0.0

    v2.0.0 primarily targets modern JavaScript by adopting ES2015 features. The release notes only mention the browser support change, while the code diff also shows internal math conversion refactors (deg2rad/rad2deg renamed to radians/degrees) and small related updates in color-space conversions.

    Breaking
  • v1.4.0

    Release v1.4.0 adds parsing support for CSS Color Module Level 4 hex notations, specifically 4-digit (#RGBA) and 8-digit (#RRGGBBAA) hexadecimal colors. It also sets package.json "sideEffects" to false to improve bundler tree-shaking. Code changes also adjust internal module import specifiers to include explicit ".js" extensions.

    Features
  • v1.3.0

    v1.3.0 adds new formatting APIs to the d3-color Color types, including color.copy and CSS-serialization helpers like formatHex, formatHsl, and formatRgb. It also deprecates the legacy hex() method in favor of formatHex. The implementation refactors prototype methods, introduces new formatting helpers on Color, Rgb, and Hsl, and updates build/test tooling.

    Features
  • v1.2.8

    v1.2.8 reverts the chroma clamping behavior for HCL color stringification. Specifically, the custom hcl.toString logic that searched for a displayable chroma value was removed.

    Breaking
  • v1.2.7

    v1.2.7 adjusts the criteria for a color to be considered displayable, accounting for rounding so borderline channel values do not flip displayable status unexpectedly. The change is reflected in both code and documentation, and new tests were added to validate displayability for named HCL input.

    Breaking
  • v1.2.6

    v1.2.6 updates d3-color's HCL behavior. It adds chroma clamping logic to HCL's toString rendering path and adjusts how achromatic Lab values convert into HCL, specifically impacting how white is represented.