Print 'text color' and 'text format' on Term with Python
Project description
term-printer
Print 'text color' and 'text format' on Term with Python
※ It may not work depending on the OS and shell used.
PIP
$ pip install term-printer
import
from term_printer import Color, StdText, cprint
If you want to override bultin print
function
from term_printer import Color, StdText, cprint as print
Usage
1. Color print
source
from term_printer import Color, StdText, cprint
cprint(StdText("1234567890", Color.BLACK))
cprint(StdText("1234567890", Color.RED))
cprint(StdText("1234567890", Color.GREEN))
cprint(StdText("1234567890", Color.YELLOW))
cprint(StdText("1234567890", Color.BLUE))
cprint(StdText("1234567890", Color.MAGENTA))
cprint(StdText("1234567890", Color.CYAN))
cprint(StdText("1234567890", Color.WHITE))
cprint(StdText("1234567890", Color.DEFAULT))
result
2. Background color print
source
from term_printer import Color, StdText, cprint
cprint(StdText("1234567890", Color.BG_BLACK))
cprint(StdText("1234567890", Color.BG_RED))
cprint(StdText("1234567890", Color.BG_GREEN))
cprint(StdText("1234567890", Color.BG_YELLOW))
cprint(StdText("1234567890", Color.BG_BLUE))
cprint(StdText("1234567890", Color.BG_MAGENTA))
cprint(StdText("1234567890", Color.BG_CYAN))
cprint(StdText("1234567890", Color.BG_WHITE))
cprint(StdText("1234567890", Color.BG_DEFAULT))
result
3. Format print
source
from term_printer import Format, StdText, cprint
cprint(StdText("1234567890", Format.BOLD))
cprint(StdText("1234567890", Format.FAINT))
cprint(StdText("1234567890", Format.ITALIC))
cprint(StdText("1234567890", Format.UNDERLINE))
cprint(StdText("1234567890", Format.BLINK))
cprint(StdText("1234567890", Format.FAST_BLINK))
cprint(StdText("1234567890", Format.REVERSE))
cprint(StdText("1234567890", Format.CONCEAL))
cprint(StdText("1234567890", Format.STRIKE))
result
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 Distribution
term-printer-1.0.tar.gz
(8.6 kB
view hashes)
Built Distribution
term_printer-1.0-py3-none-any.whl
(10.5 kB
view hashes)
Close
Hashes for term_printer-1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42a8b064687493a0e4a5c66df57bd8ce447e3b8e8ba100d21bfaffb058e8ebe4 |
|
MD5 | a98e25ecb8c5580d52dac6f7bdaf922e |
|
BLAKE2b-256 | 6298a2e625959a56dc079cec9eb56fb979ec33b9af7c0adc5e9458c89322e52f |