class_docstr: Format tokens with ANSI color sequences, for output in a 256-color
  terminal or console.  Like in `TerminalFormatter` color sequences
  are terminated at newlines, so that paging the output works correctly.
  
  The formatter takes colors from a style defined by the `style` option
  and converts them to nearest ANSI 256-color escape sequences. Bold and
  underline attributes from the style are preserved (and displayed).
  
  .. versionadded:: 0.9
  
  .. versionchanged:: 2.2
     If the used style defines foreground colors in the form ``#ansi*``, then
     `Terminal256Formatter` will map these to non extended foreground color.
     See :ref:`AnsiTerminalStyle` for more information.
  
  Options accepted:
  
  `style`
      The style to use, can be a string or a Style subclass (default:
      ``'default'``).
class_docstr_tok: ["Format","tokens","with","ANSI","color","sequences",",","for","output","in","a","256-color","terminal","or","console",".","Like","in","`","TerminalFormatter","`","color","sequences","are","terminated","at","newlines",",","so","that","paging","the","output","works","correctly",".","The","formatter","takes","colors","from","a","style","defined","by","the","`","style","`","option","and","converts","them","to","nearest","ANSI","256-color","escape","sequences",".","Bold","and","underline","attributes","from","the","style","are","preserved","(","and","displayed",")",".","..","versionadded",":",":","0.9","..","versionchanged",":",":","2.2","If","the","used","style","defines","foreground","colors","in","the","form","``","#","ansi","*","``",",","then","`","Terminal256Formatter","`","will","map","these","to","non","extended","foreground","color",".","See",":","ref",":","`","AnsiTerminalStyle","`","for","more","information",".","Options","accepted",":","`","style","`","The","style","to","use",",","can","be","a","string","or","a","Style","subclass","(","default",":","``","'default","'","``",")","."]
code: def _build_color_table(self):
      # colors 0..15: 16 basic colors
  
      self.xterm_colors.append((0x00, 0x00, 0x00))  # 0
      self.xterm_colors.append((0xCD, 0x00, 0x00))  # 1
      self.xterm_colors.append((0x00, 0xCD, 0x00))  # 2
      self.xterm_colors.append((0xCD, 0xCD, 0x00))  # 3
      self.xterm_colors.append((0x00, 0x00, 0xEE))  # 4
      self.xterm_colors.append((0xCD, 0x00, 0xCD))  # 5
      self.xterm_colors.append((0x00, 0xCD, 0xCD))  # 6
      self.xterm_colors.append((0xE5, 0xE5, 0xE5))  # 7
      self.xterm_colors.append((0x7F, 0x7F, 0x7F))  # 8
      self.xterm_colors.append((0xFF, 0x00, 0x00))  # 9
      self.xterm_colors.append((0x00, 0xFF, 0x00))  # 10
      self.xterm_colors.append((0xFF, 0xFF, 0x00))  # 11
      self.xterm_colors.append((0x5C, 0x5C, 0xFF))  # 12
      self.xterm_colors.append((0xFF, 0x00, 0xFF))  # 13
      self.xterm_colors.append((0x00, 0xFF, 0xFF))  # 14
      self.xterm_colors.append((0xFF, 0xFF, 0xFF))  # 15
  
      # colors 16..232: the 6x6x6 color cube
  
      valuerange = (0x00, 0x5F, 0x87, 0xAF, 0xD7, 0xFF)
  
      for i in range(217):
          r = valuerange[(i // 36) % 6]
          g = valuerange[(i // 6) % 6]
          b = valuerange[i % 6]
          self.xterm_colors.append((r, g, b))
  
      # colors 233..253: grayscale
  
      for i in range(1, 22):
          v = 8 + i * 10
          self.xterm_colors.append((v, v, v))
  
imports: import sys
  from pygments.formatter import Formatter
  from pygments.console import codes
  from pygments.style import ansicolors
label_desc: Use image node_id 2 for calling the Terminal256Formatter obj's underlying member method code with example usage: obj._build_color_table() without return types