def to_list(rgb, alpha=False):
    """
    Break rgb channel itno a list.

    Take a color of the format #RRGGBBAA (alpha optional and will be stripped)
    and convert to a list with format [r, g, b].
    """
    if alpha:
        return [
            int(rgb[1:3], 16),
            int(rgb[3:5], 16),
            int(rgb[5:7], 16),
            int(rgb[7:9], 16) if len(rgb) > 7 else 255
        ]
    else:
        return [
            int(rgb[1:3], 16),
            int(rgb[3:5], 16),
            int(rgb[5:7], 16)
        ]