
from polychromos.color import color

__web_colors: dict[str, color.HSLColor] = {
    'aliceblue': color.HSLColor.from_hex('#f0f8ff'),
    'antiquewhite': color.HSLColor.from_hex('#faebd7'),
    'aqua': color.HSLColor.from_hex('#00ffff'),
    'aquamarine': color.HSLColor.from_hex('#7fffd4'),
    'azure': color.HSLColor.from_hex('#f0ffff'),
    'beige': color.HSLColor.from_hex('#f5f5dc'),
    'bisque': color.HSLColor.from_hex('#ffe4c4'),
    'black': color.HSLColor.from_hex('#000000'),
    'blanchedalmond': color.HSLColor.from_hex('#ffebcd'),
    'blue': color.HSLColor.from_hex('#0000ff'),
    'blueviolet': color.HSLColor.from_hex('#8a2be2'),
    'brown': color.HSLColor.from_hex('#a52a2a'),
    'burlywood': color.HSLColor.from_hex('#deb887'),
    'cadetblue': color.HSLColor.from_hex('#5f9ea0'),
    'chartreuse': color.HSLColor.from_hex('#7fff00'),
    'chocolate': color.HSLColor.from_hex('#d2691e'),
    'coral': color.HSLColor.from_hex('#ff7f50'),
    'cornflowerblue': color.HSLColor.from_hex('#6495ed'),
    'cornsilk': color.HSLColor.from_hex('#fff8dc'),
    'crimson': color.HSLColor.from_hex('#dc143c'),
    'cyan': color.HSLColor.from_hex('#00ffff'),
    'darkblue': color.HSLColor.from_hex('#00008b'),
    'darkcyan': color.HSLColor.from_hex('#008b8b'),
    'darkgoldenrod': color.HSLColor.from_hex('#b8860b'),
    'darkgray': color.HSLColor.from_hex('#a9a9a9'),
    'darkgreen': color.HSLColor.from_hex('#006400'),
    'darkgrey': color.HSLColor.from_hex('#a9a9a9'),
    'darkkhaki': color.HSLColor.from_hex('#bdb76b'),
    'darkmagenta': color.HSLColor.from_hex('#8b008b'),
    'darkolivegreen': color.HSLColor.from_hex('#556b2f'),
    'darkorange': color.HSLColor.from_hex('#ff8c00'),
    'darkorchid': color.HSLColor.from_hex('#9932cc'),
    'darkred': color.HSLColor.from_hex('#8b0000'),
    'darksalmon': color.HSLColor.from_hex('#e9967a'),
    'darkseagreen': color.HSLColor.from_hex('#8fbc8f'),
    'darkslateblue': color.HSLColor.from_hex('#483d8b'),
    'darkslategray': color.HSLColor.from_hex('#2f4f4f'),
    'darkslategrey': color.HSLColor.from_hex('#2f4f4f'),
    'darkturquoise': color.HSLColor.from_hex('#00ced1'),
    'darkviolet': color.HSLColor.from_hex('#9400d3'),
    'deeppink': color.HSLColor.from_hex('#ff1493'),
    'deepskyblue': color.HSLColor.from_hex('#00bfff'),
    'dimgray': color.HSLColor.from_hex('#696969'),
    'dimgrey': color.HSLColor.from_hex('#696969'),
    'dodgerblue': color.HSLColor.from_hex('#1e90ff'),
    'firebrick': color.HSLColor.from_hex('#b22222'),
    'floralwhite': color.HSLColor.from_hex('#fffaf0'),
    'forestgreen': color.HSLColor.from_hex('#228b22'),
    'fuchsia': color.HSLColor.from_hex('#ff00ff'),
    'gainsboro': color.HSLColor.from_hex('#dcdcdc'),
    'ghostwhite': color.HSLColor.from_hex('#f8f8ff'),
    'gold': color.HSLColor.from_hex('#ffd700'),
    'goldenrod': color.HSLColor.from_hex('#daa520'),
    'gray': color.HSLColor.from_hex('#808080'),
    'green': color.HSLColor.from_hex('#008000'),
    'greenyellow': color.HSLColor.from_hex('#adff2f'),
    'grey': color.HSLColor.from_hex('#808080'),
    'honeydew': color.HSLColor.from_hex('#f0fff0'),
    'hotpink': color.HSLColor.from_hex('#ff69b4'),
    'indianred': color.HSLColor.from_hex('#cd5c5c'),
    'indigo': color.HSLColor.from_hex('#4b0082'),
    'ivory': color.HSLColor.from_hex('#fffff0'),
    'khaki': color.HSLColor.from_hex('#f0e68c'),
    'lavender': color.HSLColor.from_hex('#e6e6fa'),
    'lavenderblush': color.HSLColor.from_hex('#fff0f5'),
    'lawngreen': color.HSLColor.from_hex('#7cfc00'),
    'lemonchiffon': color.HSLColor.from_hex('#fffacd'),
    'lightblue': color.HSLColor.from_hex('#add8e6'),
    'lightcoral': color.HSLColor.from_hex('#f08080'),
    'lightcyan': color.HSLColor.from_hex('#e0ffff'),
    'lightgoldenrodyellow': color.HSLColor.from_hex('#fafad2'),
    'lightgray': color.HSLColor.from_hex('#d3d3d3'),
    'lightgreen': color.HSLColor.from_hex('#90ee90'),
    'lightgrey': color.HSLColor.from_hex('#d3d3d3'),
    'lightpink': color.HSLColor.from_hex('#ffb6c1'),
    'lightsalmon': color.HSLColor.from_hex('#ffa07a'),
    'lightseagreen': color.HSLColor.from_hex('#20b2aa'),
    'lightskyblue': color.HSLColor.from_hex('#87cefa'),
    'lightslategray': color.HSLColor.from_hex('#778899'),
    'lightslategrey': color.HSLColor.from_hex('#778899'),
    'lightsteelblue': color.HSLColor.from_hex('#b0c4de'),
    'lightyellow': color.HSLColor.from_hex('#ffffe0'),
    'lime': color.HSLColor.from_hex('#00ff00'),
    'limegreen': color.HSLColor.from_hex('#32cd32'),
    'linen': color.HSLColor.from_hex('#faf0e6'),
    'magenta': color.HSLColor.from_hex('#ff00ff'),
    'maroon': color.HSLColor.from_hex('#800000'),
    'mediumaquamarine': color.HSLColor.from_hex('#66cdaa'),
    'mediumblue': color.HSLColor.from_hex('#0000cd'),
    'mediumorchid': color.HSLColor.from_hex('#ba55d3'),
    'mediumpurple': color.HSLColor.from_hex('#9370db'),
    'mediumseagreen': color.HSLColor.from_hex('#3cb371'),
    'mediumslateblue': color.HSLColor.from_hex('#7b68ee'),
    'mediumspringgreen': color.HSLColor.from_hex('#00fa9a'),
    'mediumturquoise': color.HSLColor.from_hex('#48d1cc'),
    'mediumvioletred': color.HSLColor.from_hex('#c71585'),
    'midnightblue': color.HSLColor.from_hex('#191970'),
    'mintcream': color.HSLColor.from_hex('#f5fffa'),
    'mistyrose': color.HSLColor.from_hex('#ffe4e1'),
    'moccasin': color.HSLColor.from_hex('#ffe4b5'),
    'navajowhite': color.HSLColor.from_hex('#ffdead'),
    'navy': color.HSLColor.from_hex('#000080'),
    'oldlace': color.HSLColor.from_hex('#fdf5e6'),
    'olive': color.HSLColor.from_hex('#808000'),
    'olivedrab': color.HSLColor.from_hex('#6b8e23'),
    'orange': color.HSLColor.from_hex('#ffa500'),
    'orangered': color.HSLColor.from_hex('#ff4500'),
    'orchid': color.HSLColor.from_hex('#da70d6'),
    'palegoldenrod': color.HSLColor.from_hex('#eee8aa'),
    'palegreen': color.HSLColor.from_hex('#98fb98'),
    'paleturquoise': color.HSLColor.from_hex('#afeeee'),
    'palevioletred': color.HSLColor.from_hex('#db7093'),
    'papayawhip': color.HSLColor.from_hex('#ffefd5'),
    'peachpuff': color.HSLColor.from_hex('#ffdab9'),
    'peru': color.HSLColor.from_hex('#cd853f'),
    'pink': color.HSLColor.from_hex('#ffc0cb'),
    'plum': color.HSLColor.from_hex('#dda0dd'),
    'powderblue': color.HSLColor.from_hex('#b0e0e6'),
    'purple': color.HSLColor.from_hex('#800080'),
    'red': color.HSLColor.from_hex('#ff0000'),
    'rosybrown': color.HSLColor.from_hex('#bc8f8f'),
    'royalblue': color.HSLColor.from_hex('#4169e1'),
    'saddlebrown': color.HSLColor.from_hex('#8b4513'),
    'salmon': color.HSLColor.from_hex('#fa8072'),
    'sandybrown': color.HSLColor.from_hex('#f4a460'),
    'seagreen': color.HSLColor.from_hex('#2e8b57'),
    'seashell': color.HSLColor.from_hex('#fff5ee'),
    'sienna': color.HSLColor.from_hex('#a0522d'),
    'silver': color.HSLColor.from_hex('#c0c0c0'),
    'skyblue': color.HSLColor.from_hex('#87ceeb'),
    'slateblue': color.HSLColor.from_hex('#6a5acd'),
    'slategray': color.HSLColor.from_hex('#708090'),
    'slategrey': color.HSLColor.from_hex('#708090'),
    'snow': color.HSLColor.from_hex('#fffafa'),
    'springgreen': color.HSLColor.from_hex('#00ff7f'),
    'steelblue': color.HSLColor.from_hex('#4682b4'),
    'tan': color.HSLColor.from_hex('#d2b48c'),
    'teal': color.HSLColor.from_hex('#008080'),
    'thistle': color.HSLColor.from_hex('#d8bfd8'),
    'tomato': color.HSLColor.from_hex('#ff6347'),
    'turquoise': color.HSLColor.from_hex('#40e0d0'),
    'violet': color.HSLColor.from_hex('#ee82ee'),
    'wheat': color.HSLColor.from_hex('#f5deb3'),
    'white': color.HSLColor.from_hex('#ffffff'),
    'whitesmoke': color.HSLColor.from_hex('#f5f5f5'),
    'yellow': color.HSLColor.from_hex('#ffff00'),
    'yellowgreen': color.HSLColor.from_hex('#9acd32'),
}

def get_web_color(color_name: str) -> color.HSLColor:
    """
    Gets a built-in color by their name, as defined in the web standards.

    :param color_name: The name of the color, case insensitive.
    :type color_name: str
    :raise KeyError: When the requested color does not exist.
    :return: The built-in color.
    :rtype: color.HSLColor
    """
    color_name = color_name.lower().strip()
    return __web_colors[color_name]


__all__ = [
    'get_web_color',
]
