code: def resolve_colors(n_colors=None, colormap=None, colors=None):
      """
      Generates a list of colors based on common color arguments, for example
      the name of a colormap or palette or another iterable of colors. The list
      is then truncated (or multiplied) to the specific number of requested
      colors.
  
      Parameters
      ----------
      n_colors : int, default: None
          Specify the length of the list of returned colors, which will either
          truncate or multiple the colors available. If None the length of the
          colors will not be modified.
  
      colormap : str, yellowbrick.style.palettes.ColorPalette, matplotlib.cm, default: None
          The name of the matplotlib color map with which to generate colors.
  
      colors : iterable, default: None
          A collection of colors to use specifically with the plot. Overrides
          colormap if both are specified.
  
      Returns
      -------
      colors : list
          A list of colors that can be used in matplotlib plots.
  
      Notes
      -----
      This function was originally based on a similar function in the pandas
      plotting library that has been removed in the new version of the library.
      """
  
      # Work with the colormap if specified and colors is not
      if colormap is not None and colors is None:
          # Must import here to avoid recursive import
          from .palettes import PALETTES, ColorPalette
  
          if isinstance(colormap, str):
              try:
                  # try to get colormap from PALETTES first
                  _colormap = PALETTES.get(colormap, None)
  
                  if _colormap is None:
                      colormap = cm.get_cmap(colormap)
                      n_colors = n_colors or len(get_color_cycle())
                      _colors = list(
                          map(colormap, np.linspace(0, 1, num=n_colors))
                      )
  
                  else:
                      _colors = ColorPalette(_colormap).as_rgb()
                      n_colors = n_colors or len(_colors)
  
              except ValueError as e:
                  raise YellowbrickValueError(e)
  
          # if yellowbrick color palette is provided as colormap
          elif isinstance(colormap, ColorPalette):
              _colors = colormap.as_rgb()
              n_colors = n_colors or len(_colors)
  
          # if matplotlib color palette is provided as colormap
          elif isinstance(colormap, mpl.colors.Colormap):
              n_colors = n_colors or len(get_color_cycle())
              _colors = list(
                  map(colormap, np.linspace(0, 1, num=n_colors))
              )
          else:
              raise YellowbrickValueError(
                  "Colormap type {} is not recognized. Possible types are: {}".format(
                      type(colormap),
                      ", ".join(
                          [
                              "yellowbrick.style.ColorPalette,",
                              "matplotlib.cm,",
                              "str",
                          ]
                      ),
                  )
              )
  
      # Work with the color list
      elif colors is not None:
          # Warn if both colormap and colors is specified.
          if colormap is not None:
              warnings.warn(
                  "both colormap and colors specified; using colors"
              )
  
          _colors = list(colors)  # Ensure colors is a list
  
      # Get the default colors
      else:
          _colors = get_color_cycle()
  
      # Truncate or multiple the color list according to the number of colors
      if n_colors is not None and len(_colors) != n_colors:
          _colors = [
              _colors[idx % len(_colors)] for idx in np.arange(n_colors)
          ]
  
      return _colors
  
file_path: yellowbrick/yellowbrick/style/colors.py
imports: import random
  import warnings
  import numpy
  import matplotlib
  import matplotlib.cm
  from copy import copy
  from yellowbrick.exceptions import YellowbrickValueError
  from distutils.version import LooseVersion
label_desc: Use image node_id 2 for calling a global function with example usage: resolve_colors(n_colors, colormap, colors) and returns: _colors