d3 / d3-color

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

Add color.toString(format). #58

Closed mbostock closed 4 years ago

mbostock commented 4 years ago

Fixes #55.

mbostock commented 4 years ago

Closing in favor of #59.

This PR would have added overhead to the common path of color.toString by needing to string-compare the specified format and perform instanceof tests. By adding separate formatting methods, we also get better autocomplete and discovery.