colorama API Reference

Full documentation for colorama (0.4.6)

colorama.AnsiToWin32
Python Library Documentation: class AnsiToWin32 in module colorama.ansitowin32

class AnsiToWin32(builtins.object)
 |  AnsiToWin32(wrapped, convert=None, strip=None, autoreset=False)
 |
 |  Implements a 'write()' method which, on Windows, will strip ANSI character
 |  sequences from the text, and if outputting to a tty, will convert them into
 |  win32 function calls.
 |
 |  Methods defined here:
 |
 |  __init__(self, wrapped, convert=None, strip=None, autoreset=False)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  call_win32(self, command, params)
 |
 |  convert_ansi(self, paramstring, command)
 |
 |  convert_osc(self, text)
 |
 |  extract_params(self, command, paramstring)
 |
 |  flush(self)
 |
 |  get_win32_calls(self)
 |
 |  reset_all(self)
 |
 |  should_wrap(self)
 |      True if this class is actually needed. If false, then the output
 |      stream will not be affected, nor will win32 calls be issued, so
 |      wrapping stdout is not actually required. This will generally be
 |      False on non-Windows platforms, unless optional functionality like
 |      autoreset has been requested using kwargs to init()
 |
 |  write(self, text)
 |
 |  write_and_convert(self, text)
 |      Write the given text to our wrapped stream, stripping any ANSI
 |      sequences from the text, and optionally converting them into win32
 |      calls.
 |
 |  write_plain_text(self, text, start, end)
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |
 |  ANSI_CSI_RE = re.compile('\x01?\x1b\\[((?:\\d|;)*)([a-zA-Z])\x02?')
 |
 |  ANSI_OSC_RE = re.compile('\x01?\x1b\\]([^\x07]*)(\x07)\x02?')
colorama.Back
Python Library Documentation: AnsiBack in module colorama.ansi object

class AnsiBack(AnsiCodes)
 |  Method resolution order:
 |      AnsiBack
 |      AnsiCodes
 |      builtins.object
 |
 |  Data and other attributes defined here:
 |
 |  BLACK = 40
 |
 |  BLUE = 44
 |
 |  CYAN = 46
 |
 |  GREEN = 42
 |
 |  LIGHTBLACK_EX = 100
 |
 |  LIGHTBLUE_EX = 104
 |
 |  LIGHTCYAN_EX = 106
 |
 |  LIGHTGREEN_EX = 102
 |
 |  LIGHTMAGENTA_EX = 105
 |
 |  LIGHTRED_EX = 101
 |
 |  LIGHTWHITE_EX = 107
 |
 |  LIGHTYELLOW_EX = 103
 |
 |  MAGENTA = 45
 |
 |  RED = 41
 |
 |  RESET = 49
 |
 |  WHITE = 47
 |
 |  YELLOW = 43
 |
 |  ----------------------------------------------------------------------
 |  Methods inherited from AnsiCodes:
 |
 |  __init__(self)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors inherited from AnsiCodes:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
colorama.Cursor
Python Library Documentation: AnsiCursor in module colorama.ansi object

class AnsiCursor(builtins.object)
 |  Methods defined here:
 |
 |  BACK(self, n=1)
 |
 |  DOWN(self, n=1)
 |
 |  FORWARD(self, n=1)
 |
 |  POS(self, x=1, y=1)
 |
 |  UP(self, n=1)
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
colorama.Fore
Python Library Documentation: AnsiFore in module colorama.ansi object

class AnsiFore(AnsiCodes)
 |  Method resolution order:
 |      AnsiFore
 |      AnsiCodes
 |      builtins.object
 |
 |  Data and other attributes defined here:
 |
 |  BLACK = 30
 |
 |  BLUE = 34
 |
 |  CYAN = 36
 |
 |  GREEN = 32
 |
 |  LIGHTBLACK_EX = 90
 |
 |  LIGHTBLUE_EX = 94
 |
 |  LIGHTCYAN_EX = 96
 |
 |  LIGHTGREEN_EX = 92
 |
 |  LIGHTMAGENTA_EX = 95
 |
 |  LIGHTRED_EX = 91
 |
 |  LIGHTWHITE_EX = 97
 |
 |  LIGHTYELLOW_EX = 93
 |
 |  MAGENTA = 35
 |
 |  RED = 31
 |
 |  RESET = 39
 |
 |  WHITE = 37
 |
 |  YELLOW = 33
 |
 |  ----------------------------------------------------------------------
 |  Methods inherited from AnsiCodes:
 |
 |  __init__(self)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors inherited from AnsiCodes:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
colorama.Style
Python Library Documentation: AnsiStyle in module colorama.ansi object

class AnsiStyle(AnsiCodes)
 |  Method resolution order:
 |      AnsiStyle
 |      AnsiCodes
 |      builtins.object
 |
 |  Data and other attributes defined here:
 |
 |  BRIGHT = 1
 |
 |  DIM = 2
 |
 |  NORMAL = 22
 |
 |  RESET_ALL = 0
 |
 |  ----------------------------------------------------------------------
 |  Methods inherited from AnsiCodes:
 |
 |  __init__(self)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors inherited from AnsiCodes:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
colorama.ansi
Python Library Documentation: module colorama.ansi in colorama

NAME
    colorama.ansi

DESCRIPTION
    This module generates ANSI character codes to printing colors to terminals.
    See: http://en.wikipedia.org/wiki/ANSI_escape_code

CLASSES
    builtins.object
        AnsiCodes
            AnsiBack
            AnsiFore
            AnsiStyle
        AnsiCursor

    class AnsiBack(AnsiCodes)
     |  Method resolution order:
     |      AnsiBack
     |      AnsiCodes
     |      builtins.object
     |
     |  Data and other attributes defined here:
     |
     |  BLACK = 40
     |
     |  BLUE = 44
     |
     |  CYAN = 46
     |
     |  GREEN = 42
     |
     |  LIGHTBLACK_EX = 100
     |
     |  LIGHTBLUE_EX = 104
     |
     |  LIGHTCYAN_EX = 106
     |
     |  LIGHTGREEN_EX = 102
     |
     |  LIGHTMAGENTA_EX = 105
     |
     |  LIGHTRED_EX = 101
     |
     |  LIGHTWHITE_EX = 107
     |
     |  LIGHTYELLOW_EX = 103
     |
     |  MAGENTA = 45
     |
     |  RED = 41
     |
     |  RESET = 49
     |
     |  WHITE = 47
     |
     |  YELLOW = 43
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from AnsiCodes:
     |
     |  __init__(self)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from AnsiCodes:
     |
     |  __dict__
     |      dictionary for instance variables
     |
     |  __weakref__
     |      list of weak references to the object

    class AnsiCodes(builtins.object)
     |  Methods defined here:
     |
     |  __init__(self)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables
     |
     |  __weakref__
     |      list of weak references to the object

    class AnsiCursor(builtins.object)
     |  Methods defined here:
     |
     |  BACK(self, n=1)
     |
     |  DOWN(self, n=1)
     |
     |  FORWARD(self, n=1)
     |
     |  POS(self, x=1, y=1)
     |
     |  UP(self, n=1)
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables
     |
     |  __weakref__
     |      list of weak references to the object

    class AnsiFore(AnsiCodes)
     |  Method resolution order:
     |      AnsiFore
     |      AnsiCodes
     |      builtins.object
     |
     |  Data and other attributes defined here:
     |
     |  BLACK = 30
     |
     |  BLUE = 34
     |
     |  CYAN = 36
     |
     |  GREEN = 32
     |
     |  LIGHTBLACK_EX = 90
     |
     |  LIGHTBLUE_EX = 94
     |
     |  LIGHTCYAN_EX = 96
     |
     |  LIGHTGREEN_EX = 92
     |
     |  LIGHTMAGENTA_EX = 95
     |
     |  LIGHTRED_EX = 91
     |
     |  LIGHTWHITE_EX = 97
     |
     |  LIGHTYELLOW_EX = 93
     |
     |  MAGENTA = 35
     |
     |  RED = 31
     |
     |  RESET = 39
     |
     |  WHITE = 37
     |
     |  YELLOW = 33
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from AnsiCodes:
     |
     |  __init__(self)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from AnsiCodes:
     |
     |  __dict__
     |      dictionary for instance variables
     |
     |  __weakref__
     |      list of weak references to the object

    class AnsiStyle(AnsiCodes)
     |  Method resolution order:
     |      AnsiStyle
     |      AnsiCodes
     |      builtins.object
     |
     |  Data and other attributes defined here:
     |
     |  BRIGHT = 1
     |
     |  DIM = 2
     |
     |  NORMAL = 22
     |
     |  RESET_ALL = 0
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from AnsiCodes:
     |
     |  __init__(self)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from AnsiCodes:
     |
     |  __dict__
     |      dictionary for instance variables
     |
     |  __weakref__
     |      list of weak references to the object

FUNCTIONS
    clear_line(mode=2)

    clear_screen(mode=2)

    code_to_chars(code)

    set_title(title)

DATA
    BEL = '\x07'
    Back = <colorama.ansi.AnsiBack object>
    CSI = '\x1b['
    Cursor = <colorama.ansi.AnsiCursor object>
    Fore = <colorama.ansi.AnsiFore object>
    OSC = '\x1b]'
    Style = <colorama.ansi.AnsiStyle object>

FILE
    c:\users\youse\appdata\roaming\python\python312\site-packages\colorama\ansi.py

colorama.ansitowin32
Python Library Documentation: module colorama.ansitowin32 in colorama

NAME
    colorama.ansitowin32 - # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.

CLASSES
    builtins.object
        AnsiToWin32
        StreamWrapper

    class AnsiToWin32(builtins.object)
     |  AnsiToWin32(wrapped, convert=None, strip=None, autoreset=False)
     |
     |  Implements a 'write()' method which, on Windows, will strip ANSI character
     |  sequences from the text, and if outputting to a tty, will convert them into
     |  win32 function calls.
     |
     |  Methods defined here:
     |
     |  __init__(self, wrapped, convert=None, strip=None, autoreset=False)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  call_win32(self, command, params)
     |
     |  convert_ansi(self, paramstring, command)
     |
     |  convert_osc(self, text)
     |
     |  extract_params(self, command, paramstring)
     |
     |  flush(self)
     |
     |  get_win32_calls(self)
     |
     |  reset_all(self)
     |
     |  should_wrap(self)
     |      True if this class is actually needed. If false, then the output
     |      stream will not be affected, nor will win32 calls be issued, so
     |      wrapping stdout is not actually required. This will generally be
     |      False on non-Windows platforms, unless optional functionality like
     |      autoreset has been requested using kwargs to init()
     |
     |  write(self, text)
     |
     |  write_and_convert(self, text)
     |      Write the given text to our wrapped stream, stripping any ANSI
     |      sequences from the text, and optionally converting them into win32
     |      calls.
     |
     |  write_plain_text(self, text, start, end)
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables
     |
     |  __weakref__
     |      list of weak references to the object
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |
     |  ANSI_CSI_RE = re.compile('\x01?\x1b\\[((?:\\d|;)*)([a-zA-Z])\x02?')
     |
     |  ANSI_OSC_RE = re.compile('\x01?\x1b\\]([^\x07]*)(\x07)\x02?')

    class StreamWrapper(builtins.object)
     |  StreamWrapper(wrapped, converter)
     |
     |  Wraps a stream (such as stdout), acting as a transparent proxy for all
     |  attribute access apart from method 'write()', which is delegated to our
     |  Converter instance.
     |
     |  Methods defined here:
     |
     |  __enter__(self, *args, **kwargs)
     |
     |  __exit__(self, *args, **kwargs)
     |
     |  __getattr__(self, name)
     |
     |  __getstate__(self)
     |      Helper for pickle.
     |
     |  __init__(self, wrapped, converter)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  __setstate__(self, state)
     |
     |  isatty(self)
     |
     |  write(self, text)
     |
     |  ----------------------------------------------------------------------
     |  Readonly properties defined here:
     |
     |  closed
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables
     |
     |  __weakref__
     |      list of weak references to the object

DATA
    BEL = '\x07'
    Style = <colorama.ansi.AnsiStyle object>
    windll = <ctypes.LibraryLoader object>
    winterm = <colorama.winterm.WinTerm object>

FILE
    c:\users\youse\appdata\roaming\python\python312\site-packages\colorama\ansitowin32.py

colorama.colorama_text
Python Library Documentation: function colorama_text in module colorama.initialise

colorama_text(*args, **kwargs)
colorama.deinit
Python Library Documentation: function deinit in module colorama.initialise

deinit()
colorama.init
Python Library Documentation: function init in module colorama.initialise

init(autoreset=False, convert=None, strip=None, wrap=True)
colorama.initialise
Python Library Documentation: module colorama.initialise in colorama

NAME
    colorama.initialise - # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.

FUNCTIONS
    colorama_text(*args, **kwargs)

    deinit()

    init(autoreset=False, convert=None, strip=None, wrap=True)

    just_fix_windows_console()

    reinit()

    reset_all()

    wrap_stream(stream, convert, strip, autoreset, wrap)

DATA
    atexit_done = False
    fixed_windows_console = False
    orig_stderr = None
    orig_stdout = None
    wrapped_stderr = None
    wrapped_stdout = None

FILE
    c:\users\youse\appdata\roaming\python\python312\site-packages\colorama\initialise.py

colorama.just_fix_windows_console
Python Library Documentation: function just_fix_windows_console in module colorama.initialise

just_fix_windows_console()
colorama.reinit
Python Library Documentation: function reinit in module colorama.initialise

reinit()
colorama.win32
Python Library Documentation: module colorama.win32 in colorama

NAME
    colorama.win32 - # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.

CLASSES
    _ctypes.Structure(_ctypes._CData)
        CONSOLE_SCREEN_BUFFER_INFO

    class CONSOLE_SCREEN_BUFFER_INFO(_ctypes.Structure)
     |  struct in wincon.h.
     |
     |  Method resolution order:
     |      CONSOLE_SCREEN_BUFFER_INFO
     |      _ctypes.Structure
     |      _ctypes._CData
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  __str__(self)
     |      Return str(self).
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables
     |
     |  __weakref__
     |      list of weak references to the object
     |
     |  dwCursorPosition
     |
     |  dwMaximumWindowSize
     |
     |  dwSize
     |
     |  srWindow
     |
     |  wAttributes
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from _ctypes.Structure:
     |
     |  __buffer__(self, flags, /)
     |      Return a buffer object that exposes the underlying memory of the object.
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from _ctypes.Structure:
     |
     |  __new__(*args, **kwargs) class method of _ctypes.Structure
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from _ctypes._CData:
     |
     |  __ctypes_from_outparam__(...)
     |
     |  __hash__(self, /)
     |      Return hash(self).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __setstate__(...)

FUNCTIONS
    FillConsoleOutputAttribute(stream_id, attr, length, start)
        FillConsoleOutputAttribute( hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten )

    FillConsoleOutputCharacter(stream_id, char, length, start)

    GetConsoleMode(handle)

    GetConsoleScreenBufferInfo(stream_id=-11)

    POINTER(...)

    SetConsoleCursorPosition(stream_id, position, adjust=True)

    SetConsoleMode(handle, mode)

    SetConsoleTextAttribute(stream_id, attrs)

    SetConsoleTitle(title)

    byref(...)
        byref(C instance[, offset=0]) -> byref-object
        Return a pointer lookalike to a C instance, only usable
        as function argument

    winapi_test()

DATA
    ENABLE_VIRTUAL_TERMINAL_PROCESSING = 4
    STDERR = -12
    STDOUT = -11
    windll = <ctypes.LibraryLoader object>

FILE
    c:\users\youse\appdata\roaming\python\python312\site-packages\colorama\win32.py

colorama.winterm
Python Library Documentation: module colorama.winterm in colorama

NAME
    colorama.winterm - # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.

CLASSES
    builtins.object
        WinColor
        WinStyle
        WinTerm

    class WinColor(builtins.object)
     |  # from wincon.h
     |
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables
     |
     |  __weakref__
     |      list of weak references to the object
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |
     |  BLACK = 0
     |
     |  BLUE = 1
     |
     |  CYAN = 3
     |
     |  GREEN = 2
     |
     |  GREY = 7
     |
     |  MAGENTA = 5
     |
     |  RED = 4
     |
     |  YELLOW = 6

    class WinStyle(builtins.object)
     |  # from wincon.h
     |
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables
     |
     |  __weakref__
     |      list of weak references to the object
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |
     |  BRIGHT = 8
     |
     |  BRIGHT_BACKGROUND = 128
     |
     |  NORMAL = 0

    class WinTerm(builtins.object)
     |  Methods defined here:
     |
     |  __init__(self)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  back(self, back=None, light=False, on_stderr=False)
     |
     |  cursor_adjust(self, x, y, on_stderr=False)
     |
     |  erase_line(self, mode=0, on_stderr=False)
     |
     |  erase_screen(self, mode=0, on_stderr=False)
     |
     |  fore(self, fore=None, light=False, on_stderr=False)
     |
     |  get_attrs(self)
     |
     |  get_position(self, handle)
     |
     |  reset_all(self, on_stderr=None)
     |
     |  set_attrs(self, value)
     |
     |  set_console(self, attrs=None, on_stderr=False)
     |
     |  set_cursor_position(self, position=None, on_stderr=False)
     |
     |  set_title(self, title)
     |
     |  style(self, style=None, on_stderr=False)
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables
     |
     |  __weakref__
     |      list of weak references to the object

FUNCTIONS
    enable_vt_processing(fd)

    get_osfhandle(fd, /)
        Return the file handle for the file descriptor fd.

        Raises OSError if fd is not recognized.

FILE
    c:\users\youse\appdata\roaming\python\python312\site-packages\colorama\winterm.py