Skip to content
Back to top
View this page
Edit this page

# xonsh.style_tools

Xonsh color styling tools that simulate pygments, when it is unavailable.

xonsh.style_tools.color_by_name(name, fg=None, bg=None)

  Converts a color name to a color token, foreground name, and background name. Will take into consideration current foreground and background colors, if provided.

  Parameters:
    name str

      Color name.

    fg str, optional

      Foreground color name.

    bg str, optional

      Background color name.

  Returns:
    tok Token

      Pygments Token.Color subclass

    fg str or None

      New computed foreground color name.

    bg str or None

      New computed background color name.

xonsh.style_tools.norm_name(name)

  Normalizes a color name.

xonsh.style_tools.partial_color_tokenize(template)

  Tokenizes a template string containing colors. Will return a list of tuples mapping the token to the string which has that color. These sub-strings maybe templates themselves.

xonsh.style_tools.style_as_faded(template: str) → str

  Remove the colors from the template string and style as faded.