Skip to main content

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 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xontrib-termcolors-0.2.0.tar.gz (3.9 kB view details)

Uploaded Source

File details

Details for the file xontrib-termcolors-0.2.0.tar.gz.

File metadata

  • Download URL: xontrib-termcolors-0.2.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for xontrib-termcolors-0.2.0.tar.gz
Algorithm Hash digest
SHA256 65a56eaef1db1c5af47ef21cfcc78156a89816d71b5dc465e351b3808dba708c
MD5 5963fcdd793ea86b64acd8dfac57493c
BLAKE2b-256 3fa3bf80d46777a74e9404f7ed84c771256e397af12f88ecefe8983861371a43

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page