Make printing colorized messages to terminal easier
Project description
jmessaging
jmessaging
is a very simple package (with no dependencies!) that makes
printing colorized messages to the console a breeze.
Usage
import jmessaging as jm
messenger = jm.Messenger()
messenger.info('This is a message')
messenger.warning('This is a warning')
messenger.error('This is an error')
would result in
Changing the brackets and text color
The brackets around the message type can be changed along with the color associated with the type
import jmessaging as jm
messenger = jm.Messenger()
messenger._left = '<'
messenger._right = '>'
messenger._info = jm.jcolor.blue + jm.jstyle.bold
messenger._warning = jm.jcolor.magenta + jm.jstyle.bold
messenger._error = jm.jcolor.green + jm.jstyle.bold
messenger.info('This is a message')
messenger.warning('This is a warning')
messenger.error('This is an error')
would result in
Changing background color
import jmessaging as jm
messenger = jm.Messenger()
messenger._info = jm.jbackground.black + jm.jcolor.white + jm.jstyle.bold
messenger._warning = jm.jbackground.yellow + jm.jcolor.white + jm.jstyle.bold
messenger._error = jm.jbackground.red + jm.jcolor.white + jm.jstyle.bold
messenger.info('This is a message')
messenger.warning('This is a warning')
messenger.error('This is an error')
would result in
Colorizing text
Text can be colorized using the jcolorize
function from the jcolor
module
like so
import jmessaging as jm
colorized = jm.jcolorize('This is text', jm.jcolor.cyan)
print(colorized)
would result in
Printing on the same line
You can print on the same line repeatedly using the print_same_line
function
like so
import time
import jmessaging as jm
for i in range(1000, 0, -1):
jm.print_same_line(f'Current num: {i}')
time.sleep(0.001)
print('\n')
would result in
Notice the print('\n')
at the end. That's necessary (or use print()
) to move
the cursor to the next line.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
jmessaging-0.1.0.tar.gz
(44.8 kB
view hashes)
Built Distribution
Close
Hashes for jmessaging-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4e2c0dbc7a8dcc1c8442818ea9465cfc55a0e8f74304da557c73b5a555198fd |
|
MD5 | 2342ba896c48395a0e2a937fc754c4b3 |
|
BLAKE2b-256 | af22d396a1807957b046599cdd5e0197f91816fdde02f65988a82b1c5b3e6662 |