https://github.com/dyuri/xontrib-termcolors
Set terminal colors based on selected xonsh theme.
https://github.com/dyuri/xontrib-termcolors
xonsh xontrib
Last synced: 5 months ago
JSON representation
Set terminal colors based on selected xonsh theme.
- Host: GitHub
- URL: https://github.com/dyuri/xontrib-termcolors
- Owner: dyuri
- License: mit
- Created: 2021-03-10T19:48:00.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-03-11T16:34:29.000Z (about 4 years ago)
- Last Synced: 2024-04-26T01:05:37.615Z (12 months ago)
- Topics: xonsh, xontrib
- Language: Python
- Homepage:
- Size: 14.6 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Set terminal colors based on selected xonsh theme.
If you like the idea click ⭐ on the repo and tweet.## Installation
To install use pip:
```bash
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.
```bash
$ xontrib load termcolors
```If you change your theme and want to update the terminal colors use the `termcolors` command:
```bash
$ $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`:
```python
from xonsh.tools import register_custom_style
from xonsh import style_tools
from pygments.token import Tokenmystyle = {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](https://github.com/xonsh/xontrib-cookiecutter).