in chartify/_core/colors.py [0:0]
def linear_gradient(self, finish_color, n=10):
"""Return a gradient list of (n) colors between
two colors."""
# Starting and ending colors in RGB form
s = self.get_rgb()
f = finish_color.get_rgb()
# Initilize a list of the output colors with the starting color
RGB_list = [s]
# Calcuate a color at each evenly spaced value of t from 1 to n
for t in range(1, n):
# Interpolate RGB vector for color at the current value of t
curr_vector = [(s[j] + (float(t) / (n - 1)) * (f[j] - s[j])) for j in range(3)]
# Add it to our list of output colors
RGB_list.append(curr_vector)
RGB_list = [Color(rgb=r) for r in RGB_list]
return RGB_list