We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 450712b commit 9f38c1dCopy full SHA for 9f38c1d
src/tikzplotlib/_color.py
@@ -29,7 +29,8 @@
29
def _get_closest_colour_name(rgb):
30
match = None
31
mindiff = 1.0e15
32
- for h, name in webcolors.CSS3_HEX_TO_NAMES.items():
+ hex_names_dict = webcolors.CSS3_HEX_TO_NAMES if hasattr(webcolors, "CSS3_HEX_TO_NAMES") else webcolors._CSS3_HEX_TO_NAMES
33
+ for h, name in hex_names_dict.items():
34
r = int(h[1:3], 16)
35
g = int(h[3:5], 16)
36
b = int(h[5:7], 16)
0 commit comments