d3 / d3-color

Color spaces! RGB, HSL, Cubehelix, CIELAB, and more.
https://d3js.org/d3-color
ISC License
400 stars 91 forks source link

Add support for 4 and 8 digit hex codes #67

Closed zerovox closed 5 years ago

zerovox commented 5 years ago

Fixes #60

Wasn't sure how to concisely update the documentation, as this doesn't add support for the full css 4 spec, which now supports gray, hwb, lab, lch and others.

@mbostock

mbostock commented 5 years ago

Thanks for the contribution.

One question I have is now whether color.formatHex() should return an 8-digit hexadecimal when the color has opacity != 1.0. But that probably would want a major version bump as this isn’t strictly backwards-compatible.