Skip to main content

Colored text for terminal

Project description

TINGE

Output colored terminal text from Python

made with python Code style: black License: MIT PyPI Downloads

Setup and Installation

Using pip

pip install tinge

For developers / Contributors

  1. Clone this repository
git clone https://github.com/g-paras/tinge.git
cd tinge
  1. Install the module
python setup.py install

Installation Complete :thumbsup:

Example

Foreground

from tinge import colored

print(colored("This is red text", color="red"))

Or

from tinge import cprint

cprint("Hello there", color="green")

Foreground and Background

from tinge import colored

print(colored("Green on white", color="green", on_color="white"))

Or

from tinge import cprint

cprint(colored("Red on black", color="red", on_color="black"))

Styling

underline & italic are not supported on windows

from tinge import italic, underline, bold

print(italic("This is italic"))
print(underline("This is underlined"))
print(bold("This is bold"))

Styling with Foreground and Background

from tinge import colored, italic, underline, bold

print(
    underline("This is red on white",
    color="red",
    on_color="white")
)

print(
    italic("This is italic",
    color="green")
)

Specific Use Cases

These method prints by default & return None

from tinge import warn, error, info, success

warn("This is warning") # yellow bold text
info("This is to inform") # blue bold text
success("Success", strong=False) # green normal text
error("Error: File Missing") # red bold text

Horizontal Line (width equal to terminal width)

from tinge import hline

hline()  # a horizontal line
hline(text="Hello")  # horizontal line with text in middle
hline(text="Hello", color="red") # red color line with text in middle
help(hline)  # for more info

Available Colors and Styles

Foreground(color) Background(on_color)
Black Grey
Red Red
Green Green
Yellow Yellow
Blue Blue
Magenta Magenta
Cyan Cyan
White White
Style Bold Italic Underline
Function Parameters Use for
colored text, color, on_color Colored text
italic text, color, on_color Italic colored text
underline text, color, on_color Underlined colored text
bold text, color, on_color Bold colored text
warn text Yellow Bold Warning text
error text Red Bold Error text
info text Blue Bold Information text
success text Green Bold Success text

__version__ = 0.0.5, What's new?

  • colorama is no longer a requirement
  • hline method for horizontal lines
  • cprint method to directly print colored text

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

Tinge-0.0.5.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

Tinge-0.0.5-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file Tinge-0.0.5.tar.gz.

File metadata

  • Download URL: Tinge-0.0.5.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

File hashes

Hashes for Tinge-0.0.5.tar.gz
Algorithm Hash digest
SHA256 ae17cdbcac50a0db9cff72f5e425449d0970a1376b2651056fe6b6f4a87d7f7a
MD5 766893b97a9f3e9092b460c5d005f708
BLAKE2b-256 6cc2629477df994bbfef6d4120bd5434b542c5927df6ceb4e5daa9fdca11d360

See more details on using hashes here.

File details

Details for the file Tinge-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: Tinge-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

File hashes

Hashes for Tinge-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3f81035c35f8c7a562051fcd3889bddd5a539453e173b1a54925f5941dab883f
MD5 52ff50218c135f18f5d243c281688931
BLAKE2b-256 219117aef23b5ab9e63cd1c4fa0855b759feb4bf90324ec20d3ab15e43d45f68

See more details on using hashes here.

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