mgprint

Magic printer for Python CLI


Keywords
mgprint, cprint, print, magicprint, magic, 8bits, 256bits, 256color, 16bits, cli, hex, clicolor, rgb, html, console, terminal, easy, stable, linux, win, cmd, macos, color, ascii
License
MIT
Install
pip install mgprint==0.1

Documentation

Magic printer for Python CLI

Introduction

This python library will be useful for you to print beautiful colored texts with decorations and other utilities.

How to Usage

Install Library

  pip install mgprint

Import Library

  import mgprint
  # or
  from mgprint import *

Syntax 'mg' and examples

Font color

1

Example1

Background colors

2 Example2

Text decorations

3

Example2

Some functions puts the reset char by default.

Usage

from mgprint import *
# Combine flags
mprint("%Rw% WARNING[!] %;r% Undefinded values...")
mprint("%g*%[SUCCESS]%;m% Process finished")
mprint("%Bw_% Links ")
# Print all text of red since this point
mprint("%r%Red text%;%", True)
print("No styled text")
mprint("%r%Red text forever...", True)  # don't put reset char
print("This")
print("text")
print("is")
print("red")
# Reset
mreset()
print("Normal print")
# Print an banner
printHead("Hello world!", 50)
# You can replace '%' to '&' eventually
mprint("&g&Value: &;y& %d\n" % (5.3))

Output

img

Functions

Name Description
mprint(str string, bool strict=False) Print string using mg syntax and if strict is true doesn't put reset char.
cprint(str string, bool strict=False) Print likes mprint but doesn't skip the line.
mstr(str string) Return string with mg syntax converted.
printHead(str string, int dim) Print string in a banner of dim size.
mreset() Reset console style.
cls() Clean console

Color references

Background Font Reference
# 0 Black
B b Blue
C c Cyan
G g Green
M m Magenta
R r Red
W w White
Y y Yellow

Decoration references

Tag Usage
* Bold
_ Underline
- Invert