class_docstr: Inspired by pygments/formatters/terminal256.py
class_docstr_tok: ["Inspired","by","pygments\/formatters\/terminal256.py"]
code: def _closest_color(self, r, g, b):
      distance = (
          257 * 257 * 3
      )  # "infinity" (>distance from #000000 to #ffffff)
      fg_match = 0
      bg_match = 0
  
      for r_, g_, b_, fg_, bg_ in self._win32_colors:
          rd = r - r_
          gd = g - g_
          bd = b - b_
  
          d = rd * rd + gd * gd + bd * bd
  
          if d < distance:
              fg_match = fg_
              bg_match = bg_
              distance = d
      return fg_match, bg_match
  
imports: from __future__ import unicode_literals
  from ctypes import windll, byref, ArgumentError, c_char, c_long, c_ulong, c_uint, pointer
  from ctypes.wintypes import DWORD, HANDLE
  from prompt_toolkit.renderer import Output
  from prompt_toolkit.styles import ANSI_COLOR_NAMES
  from prompt_toolkit.win32_types import CONSOLE_SCREEN_BUFFER_INFO, STD_OUTPUT_HANDLE, STD_INPUT_HANDLE, COORD, SMALL_RECT
  import os
  import six
label_desc: Use image node_id 3 for calling the ColorLookupTable obj's underlying member method code with example usage: obj._closest_color(r, g, b) and returns: fg_match,  bg_match