Skip to content

Latest commit

 

History

History
64 lines (43 loc) · 1.71 KB

README.md

File metadata and controls

64 lines (43 loc) · 1.71 KB

Set terminal colors based on selected xonsh theme.

If you like the idea click ⭐ on the repo and tweet.

Installation

To install use pip:

xpip install xontrib-termcolors
# or: xpip install -U git+https://github.com/dyuri/xontrib-termcolors

Usage

This xontrib sets the colors of your (xterm compatible) terminal based on your xonsh theme.

$ xontrib load termcolors

If you change your theme and want to update the terminal colors use the termcolors command:

$ $XONSH_COLOR_STYLE="monokai"
$ termcolors

Colors

The main 16 colors will be used directly from the pygments/ptk theme. The following special colors can be set by adding the tokens to your theme:

  • Token.Terminal.Foreground - foreground color
  • Token.Terminal.Background - background color
  • Token.Terminal.Curson - cursor color

Example

To replace all colors in xonsh and terminal to green add this to your .xonshrc:

from xonsh.tools import register_custom_style
from xonsh import style_tools
from pygments.token import Token

mystyle = {k: '#00ff00' for k,c in style_tools.DEFAULT_STYLE_DICT.items()}
mystyle[Token.Terminal.Foreground] = '#00ff00'
mystyle[Token.Terminal.Curson] = '#00ff00'
mystyle[Token.Terminal.Background] = '#000000'

register_custom_style("green", mystyle, base=__xonsh__.env['XONSH_COLOR_STYLE'])
$XONSH_COLOR_STYLE="green"

xontrib load termcolors

Credits

This package was created with xontrib cookiecutter template.