def normalize_rgb(r, g, b, a):
    """Transform a rgb[a] color to #hex[a].
    """
    r = int(r, 10)
    g = int(g, 10)
    b = int(b, 10)
    if a:
        a = float(a) * 256
    if r > 255 or g > 255 or b > 255 or (a and a > 255):
        return None
    color = '#%02x%02x%02x' % (r, g, b)
    if a:
        color += '%02x' % int(a)
    return color
def normalize_rgb ( r , g , b , a ) : r = int ( r , 10 ) g = int ( g , 10 ) b = int ( b , 10 ) if a : a = float ( a ) * 256 if r > 255 or g > 255 or b > 255 or ( a and a > 255 ) : return None color = '#%02x%02x%02x' % ( r , g , b ) if a : color += '%02x' % int ( a ) return color
Transform a rgb[a] color to #hex[a].