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

Independence Day Special

Setup and Installation

Using pip

pip install tinge

Or upgrade current version:

pip install --upgrade 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("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.6.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

Tinge-0.0.6-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: Tinge-0.0.6.tar.gz
  • Upload date:
  • Size: 5.2 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.26.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

File hashes

Hashes for Tinge-0.0.6.tar.gz
Algorithm Hash digest
SHA256 c892205815132c6c467e8e46af3f2f3d90806fc4e87ddfd9c8c93481c8cd4487
MD5 0126b952e77c4de4b9e899bd83f89ede
BLAKE2b-256 7e43c1c04b5f58bd5caaf0af288a9536640d28c15af87abf2333277abd35ed22

See more details on using hashes here.

File details

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

File metadata

  • Download URL: Tinge-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 6.7 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.26.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

File hashes

Hashes for Tinge-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 bb208ff152b6e046ede475f38ab7ccb52d6e8dc36d550dd8289b7a41fc2bf9df
MD5 cf1ab6ef8142a1cc4b0f70a920b33c5c
BLAKE2b-256 f83158b3c66c143118f49dac3c9d9d0ce7818da8342cd755f682a4d01a5b34fb

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