def interpolate_tuple(startcolor, goalcolor, steps):
    """
    Take two RGB color sets and mix them over a specified number of steps.  Return the list
    """
    # white

    R = startcolor[0]
    G = startcolor[1]
    B = startcolor[2]

    targetR = goalcolor[0]
    targetG = goalcolor[1]
    targetB = goalcolor[2]

    DiffR = targetR - R
    DiffG = targetG - G
    DiffB = targetB - B

    buffer = []

    for i in range(0, steps + 1):
        iR = R + (DiffR * i // steps)
        iG = G + (DiffG * i // steps)
        iB = B + (DiffB * i // steps)

        hR = string.replace(hex(iR), "0x", "")
        hG = string.replace(hex(iG), "0x", "")
        hB = string.replace(hex(iB), "0x", "")

        if len(hR) == 1:
            hR = "0" + hR
        if len(hB) == 1:
            hB = "0" + hB

        if len(hG) == 1:
            hG = "0" + hG

        color = string.upper("#" + hR + hG + hB)
        buffer.append(color)

    return buffer
def interpolate_tuple ( startcolor , goalcolor , steps ) : R = startcolor [ 0 ] G = startcolor [ 1 ] B = startcolor [ 2 ] targetR = goalcolor [ 0 ] targetG = goalcolor [ 1 ] targetB = goalcolor [ 2 ] DiffR = targetR - R DiffG = targetG - G DiffB = targetB - B buffer = [ ] for i in range ( 0 , steps + 1 ) : iR = R + ( DiffR * i // steps ) iG = G + ( DiffG * i // steps ) iB = B + ( DiffB * i // steps ) hR = string . replace ( hex ( iR ) , "0x" , "" ) hG = string . replace ( hex ( iG ) , "0x" , "" ) hB = string . replace ( hex ( iB ) , "0x" , "" ) if len ( hR ) == 1 : hR = "0" + hR if len ( hB ) == 1 : hB = "0" + hB if len ( hG ) == 1 : hG = "0" + hG color = string . upper ( "#" + hR + hG + hB ) buffer . append ( color ) return buffer
Take two RGB color sets and mix them over a specified number of steps.  Return the list