Skip to main content

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.

Metadata

Release files for xontrib-termcolors 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xontrib-termcolors 0.2.0
File Size Uploaded Provenance Actions
xontrib-termcolors-0.2.0.tar.gz 3.9 kB Without provenance Details for xontrib-termcolors-0.2.0.tar.gz

Release files / xontrib-termcolors-0.2.0.tar.gz

Download URL xontrib-termcolors-0.2.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
65a56eaef1db1c5af47ef21cfcc78156a89816d71b5dc465e351b3808dba708c
BLAKE2b-256 checksum
How to use checksums
3fa3bf80d46777a74e9404f7ed84c771256e397af12f88ecefe8983861371a43
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for xontrib-termcolors 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page