def int_from_rgb(rgb):
    """Return an int in the range [0, 0xffffff] converted from an RGB tuple."""
    return (round(rgb[0] * 255) << 16) + (round(rgb[1] * 255) << 8) + round(
        rgb[2] * 255)
