def generateCustomColorRamp(cls, colors=[], interpolatedPoints=10):
        """
        Accepts a list of RGB tuples and interpolates between them to create a custom color ramp.
        Returns the color ramp as a list of RGB tuples.
        """
        if not (isinstance(colors, list)):
            print('COLOR RAMP GENERATOR WARNING: colors must be passed in as a list of RGB tuples.')
            raise

        numColors = len(colors)

        colorRamp = []

        # Iterate over colors
        for index in range (0, numColors - 1):
            bottomColor = colors[index]
            topColor = colors[index + 1]

            colorRamp.append(bottomColor)

            # Calculate slopes
            rSlope = (topColor[0] - bottomColor[0]) / float(interpolatedPoints)
            gSlope = (topColor[1] - bottomColor[1]) / float(interpolatedPoints)
            bSlope = (topColor[2] - bottomColor[2]) / float(interpolatedPoints)

            # Interpolate colors
            for point in range(1, interpolatedPoints):
                red = int(rSlope * point + bottomColor[0])
                green = int(gSlope * point + bottomColor[1])
                blue = int(bSlope * point + bottomColor[2])
                color = (red, green, blue)

                # Make sure the color ramp contains unique colors
                if not (color in colorRamp):
                    colorRamp.append(color)

        # Append the last color
        colorRamp.append(colors[-1])

        return colorRamp
def generateCustomColorRamp ( cls , colors = [ ] , interpolatedPoints = 10 ) : if not ( isinstance ( colors , list ) ) : print ( 'COLOR RAMP GENERATOR WARNING: colors must be passed in as a list of RGB tuples.' ) raise numColors = len ( colors ) colorRamp = [ ] for index in range ( 0 , numColors - 1 ) : bottomColor = colors [ index ] topColor = colors [ index + 1 ] colorRamp . append ( bottomColor ) rSlope = ( topColor [ 0 ] - bottomColor [ 0 ] ) / float ( interpolatedPoints ) gSlope = ( topColor [ 1 ] - bottomColor [ 1 ] ) / float ( interpolatedPoints ) bSlope = ( topColor [ 2 ] - bottomColor [ 2 ] ) / float ( interpolatedPoints ) for point in range ( 1 , interpolatedPoints ) : red = int ( rSlope * point + bottomColor [ 0 ] ) green = int ( gSlope * point + bottomColor [ 1 ] ) blue = int ( bSlope * point + bottomColor [ 2 ] ) color = ( red , green , blue ) if not ( color in colorRamp ) : colorRamp . append ( color ) colorRamp . append ( colors [ - 1 ] ) return colorRamp
Accepts a list of RGB tuples and interpolates between them to create a custom color ramp.
        Returns the color ramp as a list of RGB tuples.