Skip to content

dyuri/xontrib-termcolors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Set terminal colors based on selected xonsh theme.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages