Coder Social home page Coder Social logo

colorprint's Introduction

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...

colorprint's People

Contributors

romaindudek avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.