import re


def _rgb_txt_line(string):
    """Parse a line from an X11 rgb.txt file

    Gives a name and 3 integers (RGB values)
    """
    regexp = re.compile(
        r"([ 0-9][ 0-9][ 0-9])\s+([ 0-9][ 0-9][ 0-9])\s+([ 0-9][ 0-9][ 0-9])"
        r"\s+([a-zA-Z0-9 ]+)\s*"
    )
    match = regexp.match(string)
    if not match:
        return "", (-1, -1, -1)
    red, green, blue, name = match.groups()
    return name.strip(), (int(red), int(green), int(blue))