A python Simple python function aimed to handle printing of colored and / or decorated text to console / terminal.
With git
GitHub:
git clone https://github.com/irtsa-dev/termicol.git
With pip
PyPi
pip install idev-termicol
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.
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.")
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