def hex_to_rgb(col):
    """Extracts the RGB values as integers (from 0 to 1000) from a hex color
    string (#rrggbb).
    """
    mul = 1000 / 255
    return tuple(round(int(col.lstrip('#')[i:i + 2], 16) * mul) for i in (0, 2, 4))