def hsl_to_rgb(arr):
    """
    Converts HSL color array to RGB array

    H = [0..360]
    S = [0..1]
    l = [0..1]

    http://en.wikipedia.org/wiki/HSL_and_HSV#From_HSL

    Returns R,G,B in [0..255]
    """
    H, S, L = arr.T
    
    H = (H.copy()/255.0) * 360
    S = S.copy()/255.0
    L = L.copy()/255.0
    
    C = (1 - np.absolute(2 * L - 1)) * S

    Hp = H / 60.0
    X = C * (1 - np.absolute(np.mod(Hp, 2) - 1))

    # initilize with zero
    R = np.zeros(H.shape, float)
    G = np.zeros(H.shape, float)
    B = np.zeros(H.shape, float)

    # handle each case:

    mask = (Hp >= 0) == ( Hp < 1)
    R[mask] = C[mask]
    G[mask] = X[mask]

    mask = (Hp >= 1) == ( Hp < 2)
    R[mask] = X[mask]
    G[mask] = C[mask]

    mask = (Hp >= 2) == ( Hp < 3)
    G[mask] = C[mask]
    B[mask] = X[mask]

    mask = (Hp >= 3) == ( Hp < 4)
    G[mask] = X[mask]
    B[mask] = C[mask]

    mask = (Hp >= 4) == ( Hp < 5)
    R[mask] = X[mask]
    B[mask] = C[mask]

    mask = (Hp >= 5) == ( Hp < 6)
    R[mask] = C[mask]
    B[mask] = X[mask]

    m = L - 0.5*C
    R += m
    G += m
    B += m

    R *= 255.0
    G *= 255.0
    B *= 255.0

    return np.array((R.astype(int),G.astype(int),B.astype(int))).T
Converts HSL color array to RGB array

    H = [0..360]
    S = [0..1]
    l = [0..1]

    http://en.wikipedia.org/wiki/HSL_and_HSV#From_HSL

    Returns R,G,B in [0..255]