ANSII Color formatting for output in terminal
Project description
I am an upgraded version of termcolor that allows you to store colors as objects and use addition/calling to apply them to text. Color objects can also validate whether you use the correct color identifiers upon creation, so all errors can be caught early.
Example
import sys
from colorie import Color, colored, cprint
text = colored('Hello, World!', 'red', attrs=['reverse', 'blink'])
print(text)
cprint('Hello, World!', 'green', 'on_red')
RED_ON_CYAN = Color('red', 'on_cyan')
print(RED_ON_CYAN + 'Hello, World!')
print(RED_ON_CYAN('Hello, Universe!'))
for i in range(10):
cprint(i, 'magenta', end=' ')
cprint("Attention!", 'red', attrs=['bold'], file=sys.stderr)
RED = Color('red')
ON_WHITE = Color(highlight='on_white')
RED_ON_WHITE = RED + ON_WHITE
print(RED + "I am red" + " and I am red!")
print(RED + "I am red on white!" + ON_WHITE)
Installation
pip install colorie
Text Properties
-
Text colors
- grey
- red
- green
- yellow
- blue
- magenta
- cyan
- white
-
Text highlights
- on_grey
- on_red
- on_green
- on_yellow
- on_blue
- on_magenta
- on_cyan
- on_white
-
Attributes
- bold
- dark
- underline
- blink
- reverse
- concealed
Terminal properties
Terminal bold dark underline blink reverse concealed xterm yes no yes bold yes yes linux yes yes bold yes yes no rxvt yes no yes bold/black yes no dtterm yes yes yes reverse yes yes teraterm reverse no yes rev/red yes no aixterm normal no yes no yes yes PuTTY color no yes no yes no Windows no no no no yes no Cygwin SSH yes no color color color yes Mac Terminal yes no yes yes yes yes
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
colorie-0.1.2.tar.gz
(5.5 kB
view hashes)