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

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>
  • nl
    • Indicates a newline (basically doing \n)
    • <nl>

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.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

idev_termicol-1.0.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file idev_termicol-1.0.1.tar.gz.

File metadata

  • Download URL: idev_termicol-1.0.1.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

Hashes for idev_termicol-1.0.1.tar.gz
Algorithm Hash digest
SHA256 4fd347cad3e3ecc441c0e0e44f21d45f2cf17f36b09a82b5bb5dc88622e34846
MD5 2a9dade18bf751671b9b85f6c007a698
BLAKE2b-256 4dd4e805c292307fca39740f88c9e7369b3708a49431a25f27459efff97c13c5

See more details on using hashes here.

File details

Details for the file idev_termicol-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: idev_termicol-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for idev_termicol-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a4b2b63eaed0ab48ff9e19bf95fd0940250cdb2c16ff12f50ac1f666c3912e0d
MD5 e068b7758277f397afd43a89ae6e4f02
BLAKE2b-256 585074972a969db13f50d32b2d3fa67912b52951430df923bde4432b4b93ee48

See more details on using hashes here.

Supported by

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