class_docstr: I/O abstraction for rendering to Windows consoles.
  (cmd.exe and similar.)
class_docstr_tok: ["I\/O","abstraction","for","rendering","to","Windows","consoles",".","(","cmd.exe","and","similar",".",")"]
code: def set_attributes(
      self, attrs: Attrs, color_depth: ColorDepth
  ) -> None:
      (
          fgcolor,
          bgcolor,
          bold,
          underline,
          strike,
          italic,
          blink,
          reverse,
          hidden,
      ) = attrs
      self._hidden = bool(hidden)
  
      # Start from the default attributes.
      win_attrs: int = self.default_attrs
  
      if color_depth != ColorDepth.DEPTH_1_BIT:
          # Override the last four bits: foreground color.
          if fgcolor:
              win_attrs = win_attrs & ~0xF
              win_attrs |= self.color_lookup_table.lookup_fg_color(
                  fgcolor
              )
  
          # Override the next four bits: background color.
          if bgcolor:
              win_attrs = win_attrs & ~0xF0
              win_attrs |= self.color_lookup_table.lookup_bg_color(
                  bgcolor
              )
  
      # Reverse: swap these four bits groups.
      if reverse:
          win_attrs = (
              (win_attrs & ~0xFF)
              | ((win_attrs & 0xF) << 4)
              | ((win_attrs & 0xF0) >> 4)
          )
  
      self._winapi(
          windll.kernel32.SetConsoleTextAttribute,
          self.hconsole,
          win_attrs,
      )
  
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 16 for calling the Win32Output obj's underlying member method code with example usage: obj.set_attributes(attrs, color_depth) without return types