def is_color(string):
"""Checks if the given string is a valid color.
Arguments:
string -- the string to check
"""
if string in NAMED_COLORS:
return True
if re.match(r"^#?[0-9a-f]{3}([0-9a-f]{3})?$", string, re.IGNORECASE):
return True
return False
评论列表
文章目录