Closed nkint closed 2 years ago
Which variables in particular do you propose to export?
I've often wanted the list of css color names, which I usually copy by hand.
So named
could be exported, maybe as namedColors
or something https://github.com/d3/d3-color/blob/master/src/color.js#L19
Except they are not in a digestible format. Easy enough to copy-paste I would say: https://observablehq.com/@fil/named-css-colors
Hi,
sorry for the delay in the answer.
@curran I would say namedColor
is perfect.
Another thing I'm always copy and paste are the regex: https://github.com/d3/d3-color/blob/017a46380fd46600c1781da634039478c0b23e13/src/color.js#L8
Thanks @Fil for the observable link, but I would access it via npm (export from this package).
In the notebook one can use the menu "download json" on the left of the cell
and get
[["aliceblue","#f0f8ff"],["antiquewhite","#faebd7"],["aqua","#00ffff"],…
Hi! Sorry for the lag in this issue. @Fil thanks for that but I would love to rely only on d3-color without external json.
Other then CSS color names I always copy&paste the regex.
I will be happy to make a PR with some more export. Do you think it will be ever a change to get merged?
Thanks.
d3.color can convert the names so all you need in fact is this string:
"aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue dimgray dimgrey dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray green greenyellow grey honeydew hotpink indianred indigo ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightgrey lightpink lightsalmon lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue lightyellow lime limegreen linen magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum powderblue purple rebeccapurple red rosybrown royalblue saddlebrown salmon sandybrown seagreen seashell sienna silver skyblue slateblue slategray slategrey snow springgreen steelblue tan teal thistle tomato turquoise violet wheat white whitesmoke yellow yellowgreen"
The requested pieces (the list of color names and the regular expressions used to parse) feel like internal implementation details and I am not in favor of exposing them. Thank you for the suggestion.
Hi! I love this library, thanks 🎨 🌈.
I'd like to use some internal things in this library like css color names or color format validation regex.
Can something more be exported from
d3-color
?Is only a matter of add some
export
and I would love to provide a PR, if it has any interest. IMHO it can be a huge added value.