Skip to main content

A package to print colored text in terminal

Project description

clprint

A Python package that adds color to your print statements.

Colors ( 5 ) red -> print_r blue -> print_b green -> print_g yellow -> print_y purple -> print_p

Installation 🚀

To install clprint, run the following command:

pip install clprint

Usage ⚡️

Import the package in your Python script:

from clprint import * # imports everything
from clprint import print_g # print_g("Hello")
import clprint as cl # cl.print_r("Hello")

Printing in different colors ✨

Use the following functions to print in different colors:

print_r("Hello") # to print in red
print_g("Hello")  # to print in green
print_b("Hello")  # to print in blue
print_y("Hello")  # to print in yellow
print_p("Hello") # to print in purple

Adding a label ✨

To add a label to your print statement, pass the label argument to the print function:

print_r("Hello", label="My Label")

This will print the label in square brackets before the text:

[My Label] Hello

Adding a highlight ✨

To highlight your print statement, add the letter h to the end of the function name

print_rh("Hello", label="My Label")

This will print the text with a background color, like this:

------------------------------------
[My Label]   : Hello
------------------------------------

Example

Here is an example of how to use clPrint in your script:

import clprint

print_g("Hello, world!", label="Greeting")
print_b("This is a message in blue.", label="Info")
print_y("Warning: something went wrong.", label="Warning")
print_rh("This text is highlighted in red.", label="Error")

Note

clprint uses ANSI escape codes to change the color of the text in the terminal. This means that the colors may not show up correctly in IDEs or other environments that do not support ANSI escape codes.

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

clprint-0.0.10.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

clprint-0.0.10-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file clprint-0.0.10.tar.gz.

File metadata

  • Download URL: clprint-0.0.10.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.0

File hashes

Hashes for clprint-0.0.10.tar.gz
Algorithm Hash digest
SHA256 635a73506b41072c7935bfa1107db6c35439898d2da9baa9a2f6941eae5b814c
MD5 3f2d2cee03800213e4b3f13f81099d3c
BLAKE2b-256 e8f98fc34ac21ed75225ef80cae10ac3b3bf17069d3e3d574f7738d52c8a7469

See more details on using hashes here.

File details

Details for the file clprint-0.0.10-py3-none-any.whl.

File metadata

  • Download URL: clprint-0.0.10-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.0

File hashes

Hashes for clprint-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 f77aa39239d917d8152bbc0408e8636606d36efc77f8f6001a9d14c73a016e18
MD5 7fb3fc0797d5aa4dcc0e82111fdbb96f
BLAKE2b-256 ad22e03d9ce0b75479b798654b7e0395dec5e989291474147d523e771219fbc9

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