NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #580 most downloaded on npm
Color spaces! RGB, HSL, Cubehelix, Lab and HCL (Lch).
Last release 5 years ago
no release in 18 months
Release timing varies
gaps range from 3 weeks to 1.1 years
Most releases are documented
notes for 31 of 44 stable releases
Nothing withdrawn
no release was ever pulled
13 years old
45 releases · first in 2014
Add rgb .clamp and hsl .clamp . #102
One column per quarter.
Make build reproducible.
This package now requires Node.js 12 or higher. For more, please read Sindre Sorhus’s FAQ .
This package now requires Node.js 12 or higher. For more, please read Sindre Sorhus’s FAQ.
This release adopts ES2015 language features such as for-of and drops support for older browsers, including IE. If you need to support pre-ES2015 envi
This release adopts ES2015 language features such as for-of and drops support for older browsers, including IE. If you need to support pre-ES2015 environments, you should stick with d3-color 1.x or use a transpiler.
Nothing published for this version
Fix parsing of 4- and 8-digit hexadecimal transparent colors. #52
Add support for parsing 4- and 8-digit hexadecimal colors. #60 Thanks, @zerovox !
Deprecate color .hex; use color .formatHex instead.
Revert chroma clamping in hcl .toString.
Account for rounding when determining whether a color is displayable.
Implement chroma clamping in *hcl*.toString.
Fix achromatic representation of white in HCL colorspace.
Fix achromatic representation of black and white in HCL colorspace.
Nothing published for this version
Nothing published for this version
Nothing published for this version
* Add *color*.hex.
Add d3.lch convenience wrapper for d3.hcl.
Switch from D65 to D50 for Lab and HCL color spaces. Thanks, @danburzo!
Nothing published for this version
Fix parsing of unusual number formats (#31).
Add module entry point to package.json.
module entry point to package.json.All colors now have opacity exposed as _color_.opacity, which is a number in [0, 1]. You can pass an optional opacity argument to the color space cons
All colors now have opacity exposed as color.opacity, which is a number in [0, 1]. You can pass an optional opacity argument to the color space constructors d3.rgb, d3.hsl, d3.lab, d3.hcl or d3.cubehelix.
You can now parse rgba(…) and hsla(…) CSS color specifiers or the string “transparent” using d3.color. The “transparent” color is defined as an RGB color with zero opacity and undefined red, green and blue channels; this differs slightly from CSS which defines it as transparent black, but is useful for simplifying color interpolation logic where either the starting or ending color has undefined channels. The color.toString method now likewise returns an rgb(…) or rgba(…) string with integer channel values, not the hexadecimal RGB format, consistent with CSS computed values. This improves performance by short-circuiting transitions when the element’s starting style matches its ending style.
The new d3.color method is the primary method for parsing colors: it returns a d3.color instance in the appropriate color space, or null if the CSS color specifier is invalid. For example:
var red = d3.color("hsl(0, 80%, 50%)"); // {h: 0, l: 0.5, s: 0.8, opacity: 1}
The parsing implementation is now more robust. For example, you can no longer mix integers and percentages in rgb(…), and it correctly handles whitespace, decimal points, number signs, and other edge cases. The color space constructors d3.rgb, d3.hsl, d3.lab, d3.hcl and d3.cubehelix now always return a copy of the input color, converted to the corresponding color space. While color.rgb remains, rgb.hsl has been removed; use d3.hsl to convert a color to the RGB color space.
The RGB color space no longer greedily quantizes and clamps channel values when creating colors, improving accuracy in color space conversion. Quantization and clamping now occurs in color.toString when formatting a color for display. You can use the new color.displayable to test whether a color is out-of-gamut.
The rgb.brighter method no longer special-cases black. This is a multiplicative operator, defining a new color r′, g′, b′ where r′ = r × pow(0.7, k), g′ = g × pow(0.7, k) and b′ = b × pow(0.7, k); a brighter black is still black.
There’s a new d3.cubehelix color space, generalizing Dave Green’s color scheme! (See also d3.interpolateCubehelixDefault from d3-scale.) You can continue to define your own custom color spaces, too; see d3-hsv for an example.
See CHANGES for all D3 changes since 3.x.
Export to the global d3 in vanilla environments (d3/d3#2840).
d3 in vanilla environments (d3/d3#2840).Fix _prototype_.constructor (#25).
Fix implicitly undefined channels when parsing CSS formats.
Add support for parsing rgba(…) and hsla(…) colors.
Nothing published for this version
Resolve some circular dependencies for Babel (#22).
Nothing published for this version
Fix rounding and clamping in rgb.toString.
Moved interpolation methods to d3-interpolate.
Define d3-color module (and d3_color global), not color.
d3-color module (and d3_color global), not color.Adjusted the package.json definition for npm users.
100% for a RGB channel is now exactly 255, not 254.99999999999997.
Nothing published for this version
- Fix prototype initialization.
Don’t force RGB channel values to be integers.
Do not clamp channel values when creating HSL and RGB colors.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →