A python Simple python function aimed to handle printing of colored and / or decorated text to console / terminal.
Project description
termicol
A python Simple python function aimed to handle printing of colored and / or decorated text to console / terminal.
Installation
With git GitHub:
git clone https://github.com/irtsa-dev/termicol.git
With pip PyPi
pip install idev-termicol
Usage
To import:
from termicol.termicol import *
Then, later on you may utilize:
tprint(content: str, end: str = '\n')
# Prints off text and background in the given color with provided decorations.
# To do so, <> is used similar to html.
# Example being: <t=white>hello
showColorList()
# Prints off a list of valid arguments for color.
showDecorationList()
# Prints off a list of valid arguments for decoration.
Code Examples
from termicol.termicol import tprint
tprint("<t=red>hello, this text will be red!")
from termicol.termicol import *
tprint("<t=blue>this text will be blue,<t=red> While this text will be red!")
from termicol.termicol import *
tprint("<t=red><b=blue><d=underline>This will be underlined red text with blue background!")
from termicol.termicol import *
tprint("<t=red><b=blue>This will be red text with a blue background!<r>This will now be the default text.<t=red> Back to red text!<b=white> A blue backround is added.<r=b> Background is now default.")
Additional Notes
Valid tags to utilize:
- t | textcolor
- Will change the text color, can either be one of the valid color arguments that are seen in
showColorList()function or a list of 3 values separated by a comma for rgb values. - <t=red> | <t=20,2,30>
- Will change the text color, can either be one of the valid color arguments that are seen in
- b | bgcolor | backgroundcolor
- Will change the background color, can either be one of the valid color arguments that are seen in
showColorList()function or a list of 3 values separated by a comma for rgb values. - <b=red> | <b=20,2,30>
- Will change the background color, can either be one of the valid color arguments that are seen in
- d | deco | decorations
- Will add in decorations based on what is provided, must be ones provided in the
showDecorationList()function. - <d=underline> | <d=underline,italic>
- Will add in decorations based on what is provided, must be ones provided in the
- r
- Will reset back to default, you can also specify what to reset and provide a list (but only accepts t,b,d).
- <r> | <r=td>
- nl
- Indicates a newline (basically doing
\n) - <nl>
- Indicates a newline (basically doing
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file idev_termicol-1.0.2.tar.gz.
File metadata
- Download URL: idev_termicol-1.0.2.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4efc650bed820144f38e0199e2cb5f9cc51440041c8c3d2372ad1b26c07a1a94
|
|
| MD5 |
0f1f5cd8e3e07c0b9948b19ef312f236
|
|
| BLAKE2b-256 |
1653d1987290283e60ce507650182350e833c5a295f5c586a0e17d3f7b019355
|
File details
Details for the file idev_termicol-1.0.2-py3-none-any.whl.
File metadata
- Download URL: idev_termicol-1.0.2-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cd19a428fd17193d52c102f2a1fe3b45825fbb91393b82d98727b2019c6a1f1
|
|
| MD5 |
742d14fcc2f8474df09e31b90d6aa0a5
|
|
| BLAKE2b-256 |
62bb9a3b8f4956a97b77ecb5388af0c50a754056c29538d2dc48ccd079adbdc3
|