What it does
D3’s ISC-licensed colour modules provide chart schemes and objects for parsing or changing individual colours. Sequential, diverging, cyclical and categorical families work with D3’s scale system.
A discrete sequential scheme returns a fixed list of HEX values; for example, the documented Blues family offers three to nine colours. Its continuous counterpart accepts a position from zero to one and returns an RGB string. Use the appropriate form with an ordinal or sequential scale.
For individual values, d3-color parses CSS colours, changes components or opacity and formats the result as RGB, HSL or HEX. Invalid text returns null. Formatting can clamp an out-of-range colour into a displayable value, so call displayable when the distinction matters.
D3 is open source under the ISC licence, with permission for use and redistribution when the copyright and permission notices are retained.
Strengths
- Discrete arrays and continuous interpolation are documented separately.
- Colour parsing, component edits and output formats share one object model.
Watch out for
- The documented discrete sequential schemes have fixed supported sizes.
- Formatted output may clamp values that were outside the displayable range.
Best for
- Developers implementing colour scales in JavaScript charts
Sources
- D3 chromatic scale families (Oct 27, 2026)
- D3 sequential arrays and interpolators (Oct 27, 2026)
- D3 colour parsing and formatting (Oct 27, 2026)
- D3 ISC licence (Oct 27, 2026)
