code: def to_colors(self):
      from matplotlib.colors import Colormap, ListedColormap
  
      from ._3d import _get_cmap
  
      if isinstance(self._colormap, str):
          cmap = _get_cmap(self._colormap)
      elif isinstance(self._colormap, Colormap):
          cmap = self._colormap
      else:
          cmap = ListedColormap(
              self._colormap / 255.0, name=str(type(self._colormap))
          )
      logger.debug(
          f"Color mapping {repr(self._name)} with {cmap.name} "
          f"colormap and range {self._rng}"
      )
  
      rng = self._rng
      assert rng is not None
      scalars = self._norm(rng)
  
      colors = cmap(scalars)
      if self._opacity is not None:
          colors[:, 3] *= self._opacity
      return colors
  
file_path: mne-python/mne/viz/_3d_overlay.py
imports: from collections import OrderedDict
  import numpy
  from ..utils import logger
label_desc: Use image node_id 2 for calling the _Overlay obj's underlying member method code with example usage: obj.to_colors() and returns: colors