def generate_gradient(self, color_list, size=<NUM_LIT>):
list_length = len(color_list)<EOL>gradient_step = size / (list_length - <NUM_LIT:1>)<EOL>gradient_data = []<EOL>for x in range(list_length):<EOL><INDENT>gradient_data.append((int(gradient_step * x), color_list[x]))<EOL><DEDENT>data = []<EOL>for i in range(len(gradient_data) - <NUM_LIT:1>):<EOL><INDENT>start, color1 = gradient_data[i]<EOL>end, color2 = gradient_data[i + <NUM_LIT:1>]<EOL>color1 = self.hex_2_hsv(color1)<EOL>color2 = self.hex_2_hsv(color2)<EOL>steps = end - start<EOL>for j in range(steps):<EOL><INDENT>data.append(<EOL>self.hsv_2_hex(*self.make_mid_color(color1, color2, j / (steps)))<EOL>)<EOL><DEDENT><DEDENT>data.append(self.hsv_2_hex(*color2))<EOL>return data<EOL>
Create a gradient of size colors that passes through the colors
give in the list (the resultant list may not be exactly size long).
The gradient will be evenly distributed.
colors should be in hex format eg '#FF00FF'