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
printRGBColor(text: str, textRGB: tuple, backgroundRGB: tuple = (), decorations: list | str = [], end: str = '\n')
# Prints off text and background in the given rgb value with provided decorations.
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>
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
idev_termicol-1.0.0.tar.gz
(5.1 kB
view details)
Built Distribution
File details
Details for the file idev_termicol-1.0.0.tar.gz
.
File metadata
- Download URL: idev_termicol-1.0.0.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 | 0938d85adfa17e51dedac8fe836499ca15c198820eeadd3e8c833738b8deee80 |
|
MD5 | e299e105229144281d16fc481fdb94a2 |
|
BLAKE2b-256 | 2cd4b7a2323570849344a9c7519240d0c9cf39d90dd63bba40ab9ea7a94cb3fd |
File details
Details for the file idev_termicol-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: idev_termicol-1.0.0-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 | 71c3aefc5b13d082f161cfcca65ec65ea9a0ab301b3b1b207c90934d123d9f25 |
|
MD5 | 6874ac872e57b902c4969f8763f0f600 |
|
BLAKE2b-256 | 5318b9d8f53a4d47f9ced6284c296bce8eec6bad16c0757a30ca3702c4b8c0b1 |