def n_colors(lowcolor, highcolor, n_colors):
 diff_0 = float((highcolor[0] - lowcolor[0]))
 incr_0 = (diff_0 / (n_colors - 1))
 diff_1 = float((highcolor[1] - lowcolor[1]))
 incr_1 = (diff_1 / (n_colors - 1))
 diff_2 = float((highcolor[2] - lowcolor[2]))
 incr_2 = (diff_2 / (n_colors - 1))
 color_tuples = []
 for index in range(n_colors):
  new_tuple = ((lowcolor[0] + (index * incr_0)), (lowcolor[1] + (index * incr_1)), (lowcolor[2] + (index * incr_2)))
  color_tuples.append(new_tuple)
 return color_tuples

def n_colors ( lowcolor , highcolor , n_colors ) : diff_0 = float ( ( highcolor [ 0 ] - lowcolor [ 0 ] ) ) incr_0 = ( diff_0 / ( n_colors - 1 ) ) diff_1 = float ( ( highcolor [ 1 ] - lowcolor [ 1 ] ) ) incr_1 = ( diff_1 / ( n_colors - 1 ) ) diff_2 = float ( ( highcolor [ 2 ] - lowcolor [ 2 ] ) ) incr_2 = ( diff_2 / ( n_colors - 1 ) ) color_tuples = [ ] for index in range ( n_colors ) : new_tuple = ( ( lowcolor [ 0 ] + ( index * incr_0 ) ) , ( lowcolor [ 1 ] + ( index * incr_1 ) ) , ( lowcolor [ 2 ] + ( index * incr_2 ) ) ) color_tuples . append ( new_tuple ) return color_tuples
splits a low and high color into a list of n_colors colors in it accepts two color tuples and returns a list of n_colors colors which form the intermediate colors between lowcolor and highcolor from linearly interpolating through rgb space .