(color)
return (
        int(color[0:2], 16),
        int(color[2:4], 16),
        int(color[4:], 16),
    )
Converts a color string into an RGB tuple.

    :param str color: The string to convert.
    :return: (r, g, b)

    >>> from rivalcfg.color_helpers import parse_color_string
    >>> parse_color_string("#FF0000") # hexadecimal colors are supported
    (255, 0, 0)
    >>> parse_color_string("#F00")  # short format allowed
    (255, 0, 0)
    >>> parse_color_string("FF0000")  # "#" is optionnal
    (255, 0, 0)
    >>> parse_color_string("#ff0000")  # case insensitive
    (255, 0, 0)
    >>> parse_color_string("red")  # named color are supported
    (255, 0, 0)
    >>> parse_color_string("RED")  # named color are case insensitive
    (255, 0, 0)
Converts a color string into an RGB tuple.
Converts a color string into an RGB tuple .
def parse_color_string(color):
    """Converts a color string into an RGB tuple.

    :param str color: The string to convert.
    :return: (r, g, b)

    >>> from rivalcfg.color_helpers import parse_color_string
    >>> parse_color_string("#FF0000") # hexadecimal colors are supported
    (255, 0, 0)
    >>> parse_color_string("#F00")  # short format allowed
    (255, 0, 0)
    >>> parse_color_string("FF0000")  # "#" is optionnal
    (255, 0, 0)
    >>> parse_color_string("#ff0000")  # case insensitive
    (255, 0, 0)
    >>> parse_color_string("red")  # named color are supported
    (255, 0, 0)
    >>> parse_color_string("RED")  # named color are case insensitive
    (255, 0, 0)
    """
    # Named color
    if color.lower() in NAMED_COLORS:
        return NAMED_COLORS[color.lower()]

    # #f00 or #ff0000 -> f00 or ff0000
    if color.startswith("#"):
        color = color[1:]

    # f00 -> ff0000
    if len(color) == 3:
        color = color[0] * 2 + color[1] * 2 + color[2] * 2

    # ff0000 -> (255, 0, 0)
    return (
        int(color[0:2], 16),
        int(color[2:4], 16),
        int(color[4:], 16),
    )
def parse_color_string ( color ) : # Named color if color . lower ( ) in NAMED_COLORS : return NAMED_COLORS [ color . lower ( ) ] # #f00 or #ff0000 -> f00 or ff0000 if color . startswith ( "#" ) : color = color [ 1 : ] # f00 -> ff0000 if len ( color ) == 3 : color = color [ 0 ] * 2 + color [ 1 ] * 2 + color [ 2 ] * 2 # ff0000 -> (255, 0, 0) return ( int ( color [ 0 : 2 ] , 16 ) , int ( color [ 2 : 4 ] , 16 ) , int ( color [ 4 : ] , 16 ) , )