Colored your text
Project description
Colored console
A simple module based on c++ and bind with a python for a colored console.
Main page on github
NOTES:
-
Compiled with gcc.
-
Ansi will enable automatically!
-
Not support all consoles!
Docs:
Simply import with:
import colorcon
Defaults:
This module contains some defaults as says:
Colors in class COLORS
:
'black'
orCOLORS.Black
'white'
orCOLORS.White
'red'
orCOLORS.Red
'yellow'
orCOLORS.Yellow
'green'
orCOLORS.Green
'blue'
orCOLORS.blue
'purple'
orCOLORS.Purple
'orange'
orCOLORS.Orange
Modes in class MODES
:
-
'bold'
orCOLORS.Black
-
'light'
orCOLORS.White
-
'italic'
orCOLORS.Red
-
'underline'
orCOLORS.Yellow
Note: these aren't supported on all consoles
-
'slowblink'
orCOLORS.Green
-
'rapidblick'
orCOLORS.blue
-
'reverse'
orCOLORS.Purple
Members:
colorcon.colored
Can customize your texts!
Examples:
-
For colored text use:
colorcon.colored('im colored(with red bg and white fg)!', 'red', COLORS.White)
or you can create your custom color:
colorcon.colored('im rgb', [1, 2, 3])
-
You can add modes to output:
colored.colored("i'm bold and i have undeline", modes=['bold', MODES.Underline])
or you can simply mix modes like:\
mode = MODES.bold | MODES.Underline
colorcon.set_background
Can set color for background!
NOTES:
- Console will not reset(The color will be available)
Examples:
-
Set background color to red
colorcon.set_background('red') # set background color red colorcon.set_background([255, 0, 0]) # set background color with rgb
Then print some text that are red
colorcon.output('iam red')
colorcon.set_foreground
Same as colorcon.set_background
but adjust foreground!
colorcon.reset_all
Will reset console(Colors was set will be reset)
colorcon.output
same as python print, But it always flushes stdout after every print!
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
File details
Details for the file colorcon-0.1.3.tar.gz
.
File metadata
- Download URL: colorcon-0.1.3.tar.gz
- Upload date:
- Size: 39.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.0+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6dc81f530bb81e374d01a320400fab8b6eeb0f52a301d9e5518e137f8d54305f |
|
MD5 | f56b7afae1fd14ac53574b299480fffd |
|
BLAKE2b-256 | cc873d9e31e5b64477664bf32e6783f177e3914a7293985cc96f7e0f7014cb1d |