code: def interpolate_colors(colors, flat=False, num_colors=256):
      """Given a list of colors, create a larger list of colors interpolating
      the first one. If flatten is True a list of numers will be returned. If
      False, a list of (r,g,b) tuples. num_colors is the number of colors wanted
      in the final list"""
  
      palette = []
  
      for i in range(num_colors):
          index = (i * (len(colors) - 1)) / (num_colors - 1.0)
          index_int = int(index)
          alpha = index - float(index_int)
  
          if alpha > 0:
              r = (1.0 - alpha) * colors[index_int][0] + alpha * colors[
                  index_int + 1
              ][0]
              g = (1.0 - alpha) * colors[index_int][1] + alpha * colors[
                  index_int + 1
              ][1]
              b = (1.0 - alpha) * colors[index_int][2] + alpha * colors[
                  index_int + 1
              ][2]
          else:
              r = (1.0 - alpha) * colors[index_int][0]
              g = (1.0 - alpha) * colors[index_int][1]
              b = (1.0 - alpha) * colors[index_int][2]
  
          if flat:
              palette.extend((int(r), int(g), int(b)))
          else:
              palette.append((int(r), int(g), int(b)))
  
      return palette
  
file_path: TimeSide/timeside/plugins/grapher/utils.py
imports: import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: interpolate_colors(colors, flat, num_colors) and returns: palette