Set terminal colors based on selected xonsh theme.
Project description
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 colorToken.Terminal.Background
- background colorToken.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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.