littlefish/colourutil.py
def html_color_to_rgba(html_colour, alpha):
    """
    :param html_colour: Colour string like FF0088
    :param alpha: Alpha value (opacity)
    :return: RGBA semitransparent version of colour for use in css
    """
    html_colour = html_colour.upper()
    if html_colour[0] == '#':
        html_colour = html_colour[1:]

    r_str = html_colour[0:2]
    g_str = html_colour[2:4]
    b_str = html_colour[4:6]

    r = int(r_str, 16)
    g = int(g_str, 16)
    b = int(b_str, 16)

    return 'rgba(%s, %s, %s, %s)' % (r, g, b, alpha)
def html_color_to_rgba(html_colour, alpha):
    """
    :param html_colour: Colour string like FF0088
    :param alpha: Alpha value (opacity)
    :return: RGBA semitransparent version of colour for use in css
    """
    html_colour = html_colour.upper()
    if html_colour[0] == '#':
        html_colour = html_colour[1:]

    r_str = html_colour[0:2]
    g_str = html_colour[2:4]
    b_str = html_colour[4:6]

    r = int(r_str, 16)
    g = int(g_str, 16)
    b = int(b_str, 16)

    return 'rgba(%s, %s, %s, %s)' % (r, g, b, alpha)
:param html_colour: Colour string like FF0088
    :param alpha: Alpha value (opacity)
    :return: RGBA semitransparent version of colour for use in css