Colored console
A simple module based on c++ and bind with a python for a colored console.
Main page on github
NOTES:
Docs:
Simply import with:
import colorcon
Defaults:
This module contains some defaults as says:
Colors in class COLORS
:
'black'
or COLORS.Black
'white'
or COLORS.White
'red'
or COLORS.Red
'yellow'
or COLORS.Yellow
'green'
or COLORS.Green
'blue'
or COLORS.blue
'purple'
or COLORS.Purple
'orange'
or COLORS.Orange
Modes in class MODES
:
-
'bold'
or COLORS.Black
-
'light'
or COLORS.White
-
'italic'
or COLORS.Red
-
'underline'
or COLORS.Yellow
Note: these aren't supported on all consoles
-
'slowblink'
or COLORS.Green
-
'rapidblick'
or COLORS.blue
-
'reverse'
or COLORS.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')
colorcon.set_background([255, 0, 0])
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!