class_docstr: ColorMap(pos, color, mapping=ColorMap.CLIP)
  
  ColorMap stores a mapping of specific data values to colors, for example:
  
      | 0.0 → black
      | 0.2 → red
      | 0.6 → yellow
      | 1.0 → white
  
  The colors for intermediate values are determined by interpolating between
  the two nearest colors in RGB color space.
  
  A ColorMap object provides access to the interpolated colors by indexing with a float value:
  ``cm[0.5]`` returns a QColor corresponding to the center of ColorMap `cm`.
docstr: __init__(pos, color, mapping=ColorMap.CLIP)
  
  Parameters
  ----------
  pos: array_like of float, optional
      Assigned positions of specified colors. `None` sets equal spacing.
      Values need to be in range 0.0-1.0.
  color: array_like of color_like
      List of colors, interpreted via :func:`mkColor() <pyqtgraph.mkColor>`.
  mapping: str or int, optional
      Controls how values outside the 0 to 1 range are mapped to colors.
      See :func:`setMappingMode() <ColorMap.setMappingMode>` for details. 
      
      The default of `ColorMap.CLIP` continues to show
      the colors assigned to 0 and 1 for all values below or above this range, respectively.
docstr_tok: ["__init__","(","pos",",","color",",","mapping=ColorMap.CLIP",")","Parameters","--","--","--","--","--","pos",":","array_like","of","float",",","optional","Assigned","positions","of","specified","colors",".","`","None","`","sets","equal","spacing",".","Values","need","to","be","in","range","0.0-1.0.","color",":","array_like","of","color_like","List","of","colors",",","interpreted","via",":","func",":","`","mkColor","(",")","<","pyqtgraph.mkColor",">","`",".","mapping",":","str","or","int",",","optional","Controls","how","values","outside","the","0","to","1","range","are","mapped","to","colors",".","See",":","func",":","`","setMappingMode","(",")","<","ColorMap.setMappingMode",">","`","for","details",".","The","default","of","`","ColorMap.CLIP","`","continues","to","show","the","colors","assigned","to","0","and","1","for","all","values","below","or","above","this","range",",","respectively","."]
code: def __init__(
      self,
      pos,
      color,
      mapping=CLIP,
      mode=None,
      linearize=False,
      name="",
  ):
      """
      __init__(pos, color, mapping=ColorMap.CLIP)
  
      Parameters
      ----------
      pos: array_like of float, optional
          Assigned positions of specified colors. `None` sets equal spacing.
          Values need to be in range 0.0-1.0.
      color: array_like of color_like
          List of colors, interpreted via :func:`mkColor() <pyqtgraph.mkColor>`.
      mapping: str or int, optional
          Controls how values outside the 0 to 1 range are mapped to colors.
          See :func:`setMappingMode() <ColorMap.setMappingMode>` for details.
  
          The default of `ColorMap.CLIP` continues to show
          the colors assigned to 0 and 1 for all values below or above this range, respectively.
      """
      self.name = name  # storing a name helps identify ColorMaps sampled by Palette
      if pos is None:
          order = range(len(color))
          self.pos = np.linspace(0.0, 1.0, num=len(color))
      else:
          self.pos = np.array(pos)
          order = np.argsort(self.pos)
          self.pos = self.pos[order]
  
      self.color = np.zeros((len(color), 4))  # stores float rgba values
      for cnt, idx in enumerate(order):
          self.color[cnt] = mkColor(color[idx]).getRgbF()
      # alternative code may be more efficient, but fails to handle lists of QColor.
      # self.color = np.apply_along_axis(
      #     func1d = lambda x: np.uint8( mkColor(x).getRgb() ), # cast RGB integer values to uint8
      #     axis   = -1,
      #     arr    = color,
      #     )[order]
  
      self.mapping_mode = self.CLIP  # default to CLIP mode
      if mapping is not None:
          self.setMappingMode(mapping)
      self.stopsCache = {}
      if linearize:
          self.linearize()
  
imports: from collections.abc import Callable, Sequence
  from os import listdir, path
  import numpy
  from .functions import clip_array, clip_scalar, colorDistance, eq, mkColor
  from .Qt import QtCore, QtGui
label_desc: Use image node_id 1 to create a new ColorMap object from inherited base classes: object with example: obj = ColorMap(pos, color, mapping, mode, linearize, name)