Skip to content

Commit 13ab563

Browse files
committed
Compat with webcolors v24.6.0
Work around ubernostrum/webcolors@68ba427 / ubernostrum/webcolors#20
1 parent 450712b commit 13ab563

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: src/tikzplotlib/_color.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@
2929
def _get_closest_colour_name(rgb):
3030
match = None
3131
mindiff = 1.0e15
32-
for h, name in webcolors.CSS3_HEX_TO_NAMES.items():
32+
hex_names_dict = (
33+
webcolors.CSS3_HEX_TO_NAMES
34+
if hasattr(webcolors, "CSS3_HEX_TO_NAMES")
35+
else webcolors._definitions._CSS3_HEX_TO_NAMES
36+
)
37+
for h, name in hex_names_dict.items():
3338
r = int(h[1:3], 16)
3439
g = int(h[3:5], 16)
3540
b = int(h[5:7], 16)

0 commit comments

Comments
 (0)