code: def select_color(cpcolor, evalcolor, idx=0):
      
      # Random colors by default
      color = utilities.color_generator()
  
      # Constant color for control points grid
      if isinstance(cpcolor, str):
          color[0] = cpcolor
  
      # User-defined color for control points grid
      if isinstance(cpcolor, (list, tuple)):
          color[0] = cpcolor[idx]
  
      # Constant color for evaluated points grid
      if isinstance(evalcolor, str):
          color[1] = evalcolor
  
      # User-defined color for evaluated points grid
      if isinstance(evalcolor, (list, tuple)):
          color[1] = evalcolor[idx]
  
      return color
docs: Selects item color for plotting.
  
      :param cpcolor: color for control points grid item
      :type cpcolor: str, list, tuple
      :param evalcolor: color for evaluated points grid item
      :type evalcolor: str, list, tuple
      :param idx: index of the current geometry object
      :type idx: int
      :return: a list of color values
      :rtype: list