
Terminal Utilities
******************

Utilities for working with the terminal.

**Module Overview:**

   format - wrap text with ANSI for the given colors or attributes

stem.util.term.Color(enum)

stem.util.term.BgColor(enum)

   Enumerations for foreground or background terminal color.

   +-------------+---------------+
   | Color       | Description   |
   +=============+===============+
   | **BLACK**   | black color   |
   +-------------+---------------+
   | **BLUE**    | blue color    |
   +-------------+---------------+
   | **CYAN**    | cyan color    |
   +-------------+---------------+
   | **GREEN**   | green color   |
   +-------------+---------------+
   | **MAGENTA** | magenta color |
   +-------------+---------------+
   | **RED**     | red color     |
   +-------------+---------------+
   | **WHITE**   | white color   |
   +-------------+---------------+
   | **YELLOW**  | yellow color  |
   +-------------+---------------+

stem.util.term.Attr(enum)

   Enumerations of terminal text attributes.

   +---------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | Attr                | Description                                                                                                                                                                                            |
   +=====================+========================================================================================================================================================================================================+
   | **BOLD**            | heavy typeface                                                                                                                                                                                         |
   +---------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | **HILIGHT**         | inverted foreground and background                                                                                                                                                                     |
   +---------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | **UNDERLINE**       | underlined text                                                                                                                                                                                        |
   +---------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | **READLINE_ESCAPE** | wrap encodings in RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE sequences                                                                                                                            |
   +---------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

stem.util.term.format(msg, *attr)

   Simple terminal text formatting using ANSI escape sequences. The
   following are some toolkits providing similar capabilities:

   * django.utils.termcolors

   * termcolor

   * colorama

   Parameters:
      * **msg** (*str*) -- string to be formatted

      * **attr** (*str*) -- text attributes, this can be "Color",
        "BgColor", or "Attr" enums and are case insensitive (so
        strings like 'red' are fine)

   Returns:
      **str** wrapped with ANSI escape encodings, starting with the
      given attributes and ending with a reset
