Skip to main content

Une librairie pour imprimer en couleur à l'écran

Project description

colorPrint

colorPrint is a very light weight module that enables you to print in color without having to use fstring codes and memorising complicated (or too long to write !) syntax...

I wrote it in order to save time when I'm coding scripts that generates a lot of terminal prompts which are painfull to read wthout colors !

Basic usage

The script uses a cprint function and tags in the string starting by the § symbol.

from colorPrint import cprint

# First Try :
cprint("Now I can use §-SUCCESSGreen color !")

cprint("The §_INFOtext§ I want to §_SUCCESSprint§ using §_WARNINGWarning background!")

# Same with shortcodes :
cprint("The §_#Itext§ I want to §_#Sprint§ using §_#WBackground colors!")
cprint("Or §-#Itext§ using §-#WForeground colors!")

# Compatibility
# use of the § symbol
cprint("colorPrint is §-#Icompatible§ with the usage of the § §§_#Scharacter§ if you need it §-#Danyway§ !")
# use of fstring
value = "Oh la la"
cprint(f"§_#I{value}§, colorPrint is §-#Icompatible§ with the usage of fStrings variables §-#Dif you need it§ !")

ScreenShot ColorPrint Module

As simple as that !

How tags works

ColorPrint tags allways starts with § symbol. In order to change the text color or background color, you need to start with an opening tag.

The closing tag is needed only if you wnat to end the start tag effect before the end of the string.

Opening tag

The opening tag second char is meant to define if it is a backgound or a foreground color. it is either -(foreground) or _(Background)

Available opening tags:

ScreenShot ColorPrint Module

Closing tag

The closing tag is just §. As long as it comes after an opening tag, it will be considered as a closing tag.


More to come...

In the next upgrade I will add the ability to change the default colors right after importing the module...

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

easy-colorprint-0.1.4.tar.gz (4.2 kB view details)

Uploaded Source

File details

Details for the file easy-colorprint-0.1.4.tar.gz.

File metadata

  • Download URL: easy-colorprint-0.1.4.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for easy-colorprint-0.1.4.tar.gz
Algorithm Hash digest
SHA256 72f8a521d96f3aa1aed22090d1fb9dc5eda220d15a31fdd3c5ce62ecddd520cd
MD5 cdcaf2e59d9c8413854d5b1a8ad6d350
BLAKE2b-256 380ea3c15e45cad46a9c0b96b8a8bbd82d45d36c4fe028a1bba85360ad867bb4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page