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 line

line()  # a horizontal line
line(text="Hello")  # horizontal line with text in middle
line(text="Hello", color="red") # red color line with text in middle
help(line)  # 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
  • line 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.7.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

Tinge-0.0.7-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: Tinge-0.0.7.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for Tinge-0.0.7.tar.gz
Algorithm Hash digest
SHA256 87823462a6aeb044e64ad8b3b59413eaee8ce64117d0e8e8ed8ecc61adc35748
MD5 2fca99a9302d5f9a0cfac350952a5da8
BLAKE2b-256 03b985dbe452ea80d05897eaa8e14fdde4325db3c37e2e12ba451016709ae84d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: Tinge-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for Tinge-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 b7c40d4f9ad425987ad54158436391b950d754105a1aa93aac1b012a88d29a20
MD5 ab822f7830a5abc658a16f4347b9481b
BLAKE2b-256 fc9e53702fcd566a769c3bf0f4b05d8ad321b42721bbec26dd62bc3200eff436

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