class_docstr: Inspired by pygments/formatters/terminal256.py
class_docstr_tok: ["Inspired","by","pygments\/formatters\/terminal256.py"]
code: def _color_indexes(self, color: str) -> tuple[int, int]:
      indexes = self.best_match.get(color, None)
      if indexes is None:
          try:
              rgb = int(str(color), 16)
          except ValueError:
              rgb = 0
  
          r = (rgb >> 16) & 0xFF
          g = (rgb >> 8) & 0xFF
          b = rgb & 0xFF
          indexes = self._closest_color(r, g, b)
          self.best_match[color] = indexes
      return indexes
  
imports: from __future__ import annotations
  import sys
  import os
  from ctypes import ArgumentError, byref, c_char, c_long, c_uint, c_ulong, pointer
  from ctypes.wintypes import DWORD, HANDLE
  from typing import Callable, TextIO, TypeVar
  from prompt_toolkit.cursor_shapes import CursorShape
  from prompt_toolkit.data_structures import Size
  from prompt_toolkit.styles import ANSI_COLOR_NAMES, Attrs
  from prompt_toolkit.utils import get_cwidth
  from prompt_toolkit.win32_types import CONSOLE_SCREEN_BUFFER_INFO, COORD, SMALL_RECT, STD_INPUT_HANDLE, STD_OUTPUT_HANDLE
  from ..utils import SPHINX_AUTODOC_RUNNING
  from .base import Output
  from .color_depth import ColorDepth
label_desc: Use image node_id 4 for calling the ColorLookupTable obj's underlying member method code with example usage: obj._color_indexes(color) and returns: indexes