A tool to print and demo ansi color codes for a 256 color terminal
Project description
ansi256-colors
A tool to print and demo ansi color codes for a 256 color terminal.
Install
Install using pip:
pip install ansi256colors
This will install ansi256
to your python bin. You can then call the script so
long as that is in your path.
Usage
> ansi256 -h
usage: ansi256 [-h] {print-table,test,write} ...
a tool for printing, testing, and exporting ansi color escapes
positional arguments:
{print-table,test,write}
print-table print a table of the ansi color codes
test test color codes on a string
write write a zsh-rc style file that exports all color codes
options:
-h, --help show this help message and exit
Printing Tables
> ansi256 print-table --help
usage: ansi256 print-table [-h] [-f [0-255]] [-b [0-255]] {fg,bg,both}
positional arguments:
{fg,bg,both} specify whether to print foreground, background, or both color code tables
options:
-h, --help show this help message and exit
-f [0-255], --foreground [0-255]
specify a foreground color to be on top of the background table
-b [0-255], --background [0-255]
specify a background color to be the background of the foreground table
For example:
ansi256 print-table both
ansi256 print-table -b 218 fg
Printing Tests
> ansi256 test -h
usage: ansi256 test [-h] [-f [0-255]] [-b [0-255]] TEXT
positional arguments:
TEXT text to test
options:
-h, --help show this help message and exit
-f [0-255], --foreground [0-255]
specify the foreground color code (0-255)
-b [0-255], --background [0-255]
specify the background color code (0-255)
For example:
ansi256 test -b 218 -f 196 "This is a test of red on pink"
Writing RC files
> ansi256 write -h
usage: ansi256 write [-h] FILE
positional arguments:
FILE file to write the exports to
options:
-h, --help show this help message and exit
> ansi256 write testrc
> head -5 testrc
export COLOR0_FG=$'%{\e[38;5;0m%}'
export COLOR0_BG=$'%{\e[48;5;0m%}'
export COLOR1_FG=$'%{\e[38;5;1m%}'
export COLOR1_BG=$'%{\e[48;5;1m%}'
export COLOR2_FG=$'%{\e[38;5;2m%}'
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.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file ansi256colors-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: ansi256colors-1.0.0-py3-none-any.whl
- Upload date:
- Size: 28.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | be0017b10605da732c9219ba3c23bdd14f17301f7d1c60df22925003034315ea |
|
MD5 | d5df6ca106f572d207085fd8d82de110 |
|
BLAKE2b-256 | a99fbe7f78fb52508c0c466c27e28e20e5044aca45eeaeb9bab777143dc6b43c |