Skip to main content

This module can colorize any text in your terminal

Project description

PaintPrint

This module can colorize any text in your terminal

Installing

pip install PaintPrint

Quick start

Hello world

This is a simple hello world:

from PaintPrint import *

bprint("Hello world!", 
       FORMATTING.BOLD, 
       FOREGROUND.RED, 
       BACKGROUND.GREEN)

In your console you can see something like this:

Unreadable symbols

If you see incomprehensible symbols instead of colors in the console, perform this function at the beginning of your code:

from PaintPrint import *
neutralizeColorProblem()

Templates

In this module you can use some templates for beautiful print on terminal:

from PaintPrint import *

bprint("TEMPLATES", 
       FORMATTING.BORDERED, 
       FORMATTING.BOLD, 
       FOREGROUND.MAGENTA, 
       BACKGROUND.WHITE)

print("Template for links: " + bformat("python.org", TEMPLATE.URL))
bprint("This is a `positive` template", TEMPLATE.POSITIVE)
bprint("\tAnd this is a `negative`", TEMPLATE.NEGATIVE)
print("You also can write " + bformat("yes", TEMPLATE.YES) + " and " + bformat("no", TEMPLATE.NO) + " like here")
print("If you like " + bformat("black and white", TEMPLATE.BLACKWHITE1) + " or " + bformat("white and black", TEMPLATE.BLACKWHITE2) + " you can using special templates!")

All functions

Install PaintPrint in perform this code on your PC:

from PaintPrint import *
neutralizeColorProblem()

bprint("TEMPLATES",
       FORMATTING.BORDERED,
       FORMATTING.BOLD,
       FOREGROUND.MAGENTA,
       BACKGROUND.WHITE)

print("Template for links: " + bformat("python.org", TEMPLATE.URL))
bprint("This is a `positive` template", TEMPLATE.POSITIVE)
bprint("\tAnd this is a `negative`", TEMPLATE.NEGATIVE)
print("You also can write " + bformat("yes", TEMPLATE.YES) + " and " + bformat("no", TEMPLATE.NO) + " like here")
print("If you like " + bformat("black and white", TEMPLATE.BLACKWHITE1) + " or " + bformat("white and black", TEMPLATE.BLACKWHITE2) + " you can using special templates!")

print("\n")

bprint("COLORS - BACKGROUND",
       FORMATTING.BORDERED,
       FORMATTING.BOLD,
       FOREGROUND.MAGENTA,
       BACKGROUND.WHITE)

print("In " + bformat("PaintPrint", TEMPLATE.BLACKWHITE1) + " you can find " + bformat("10", FOREGROUND.GREEN)+ " backgrounds and foregrounds:")
bprint("BACKGROUNDS", FORMATTING.BORDERED)
bprint("Red", BACKGROUND.RED, end="\t")
bprint("Green", BACKGROUND.GREEN)

bprint("Yellow", BACKGROUND.YELLOW, end="\t")
bprint("Blue", BACKGROUND.BLUE)

bprint("Magenta", BACKGROUND.MAGENTA, end="\t")
bprint("Cyan", BACKGROUND.CYAN)

bprint("White", BACKGROUND.WHITE, end="\t")
bprint("Black", BACKGROUND.BLACK)

bprint("Gold", BACKGROUND.GOLD, end="\t")
bprint("Silver", BACKGROUND.SILVER)
bprint("Copper", BACKGROUND.COPPER)

print()

bprint("COLORS - BACKGROUND",
       FORMATTING.BORDERED,
       FORMATTING.BOLD,
       FOREGROUND.MAGENTA,
       BACKGROUND.WHITE)
bprint("Red", FOREGROUND.RED, end="\t")
bprint("Green", FOREGROUND.GREEN)

bprint("Yellow", FOREGROUND.YELLOW, end="\t")
bprint("Blue", FOREGROUND.BLUE)

bprint("Magenta", FOREGROUND.MAGENTA, end="\t")
bprint("Cyan", FOREGROUND.CYAN)

bprint("White", FOREGROUND.WHITE, end="\t")
bprint("Black", FOREGROUND.BLACK)

bprint("Gold", FOREGROUND.GOLD, end="\t")
bprint("Silver", FOREGROUND.SILVER)
bprint("Copper", FOREGROUND.COPPER)

print("\n\nAnd more " + bformat("240", FOREGROUND.GOLD) + " colors with indexes, RGB or HEX support:")
for i in range(256):
    bprint("*", UserColor.BACKGROUND(i).get(), end="")
print()
for i in range(256):
    bprint("*", UserColor.FOREGROUND(i).get(), end="")
print("\n")

print("Also you can set your own color by RGB or HEX:")
bprint("Foreground: ", FORMATTING.BORDERED,
       FORMATTING.BOLD,
       FOREGROUND.MAGENTA,
       BACKGROUND.WHITE)
bprint("\t\tPrint by RGB", UserColor.FOREGROUND((150, 15, 240)).get())
bprint("\t\tPrint by HEX", UserColor.FOREGROUND("#960FF0").get())
bprint("\t\tPrint by HEX without #-symbol", UserColor.FOREGROUND("960FF0").get())

bprint("Background: ", FORMATTING.BORDERED,
       FORMATTING.BOLD,
       FOREGROUND.MAGENTA,
       BACKGROUND.WHITE)
bprint("\t\tPrint by RGB", UserColor.BACKGROUND((150, 15, 240)).get())
bprint("\t\tPrint by HEX", UserColor.BACKGROUND("#960FF0").get())
bprint("\t\tPrint by HEX without #-symbol", UserColor.BACKGROUND("960FF0").get())

You will see something like this:

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

PaintPrint-1.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

PaintPrint-1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file PaintPrint-1.0.tar.gz.

File metadata

  • Download URL: PaintPrint-1.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.8 CPython/3.9.5 Windows/10

File hashes

Hashes for PaintPrint-1.0.tar.gz
Algorithm Hash digest
SHA256 5b9f4645ed8d46880c9530fe5cae9ffef46ce093429364ec652ddfc8689fe9a4
MD5 887473d744cc580a8f4232f1b7a41b40
BLAKE2b-256 63ef75f4ce424ec4ae772cc3dbb5602deb478ef0414b5be043f765cbc25ee4a2

See more details on using hashes here.

File details

Details for the file PaintPrint-1.0-py3-none-any.whl.

File metadata

  • Download URL: PaintPrint-1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.8 CPython/3.9.5 Windows/10

File hashes

Hashes for PaintPrint-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c47269f4d53923c0a30c3456c6299960eaaaa1ade1b503bb0f507dc9b885e8e
MD5 ffd8e218483ffb51a2e36ce6ec1812ae
BLAKE2b-256 3ea6bee5efdc88758cb03687254cc7018d374ae480816c0505b02d38af622583

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