Skip to main content

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>
  • 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>
  • 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>
  • 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


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 hashes)

Uploaded Source

Built Distribution

idev_termicol-1.0.0-py3-none-any.whl (5.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page