I am using this Function
def closest_colour(requested_colour):
min_colours = {}
for key, name in webcolors.css3_hex_to_names.items():
r_c, g_c, b_c = webcolors.hex_to_rgb(key)
rd = (r_c - requested_colour[0]) ** 2
gd = (g_c - requested_colour[1]) ** 2
bd = (b_c - requested_colour[2]) ** 2
min_colours[(rd + gd + bd)] = name
return min_colours[min(min_colours.keys())]
I am using Webcolor 1.11.1 Python 3.8.8 and I am getting this Error in line
for key, name in webcolors.css21_hex_to_names.items():
AttributeError: module 'webcolors' has no attribute 'css21_hex_to_names'