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)[source]

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:
namestr

Color name.

fgstr, optional

Foreground color name.

bgstr, optional

Background color name.

Returns:
tokToken

Pygments Token.Color subclass

fgstr or None

New computed foreground color name.

bgstr or None

New computed background color name.

xonsh.style_tools.norm_name(name)[source]

Normalizes a color name.

xonsh.style_tools.partial_color_tokenize(template)[source]

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[source]

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