This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Thu Mar 19 03:46:47 -0700 2009 | |
| |
Makefile | Thu Mar 19 03:46:47 -0700 2009 | |
| |
README | Wed Jun 24 03:26:41 -0700 2009 | |
| |
readme.rst | Sun May 24 02:24:36 -0700 2009 | |
| |
setup.py | Wed Jun 24 04:26:57 -0700 2009 | |
| |
termstyle/ | Sun May 24 02:24:36 -0700 2009 | |
| |
test.py | Thu Mar 19 03:20:29 -0700 2009 |
readme.rst
termstyle
termstyle is a simple python library for adding coloured output to terminal (console) programs. The definitions come from ECMA-048, the "Control Functions for Coded Character Sets" standard.
Installation:
easy_install termstyle
or from source:
./setup.py bdist_egg cp dist/termstyle-*.egg <path-to-your-python-libraries>
Example Usage:
from termstyle import *
print "%s:%s" % (red('Hey'), green('how are you?'))
print blue('How ', bold('you'), ' doin?')
or, you can use a colour just as a string:
print "%sBlue!%s" % (blue, reset)
Styles:
reset or default (no colour / style)
colour:
black red green yellow blue magenta cyan white
background colour:
bg_black bg_red bg_green bg_yellow bg_blue bg_magenta bg_cyan bg_white bg_default
In terminals supporting transparency bg_default is often used to set the background to transparent [1].
weight:
bold inverted
style:
italic underscore
Controls:
auto() - sets colouring on only if sys.stdout is a terminal disabe() - disable colours enable() - enable colours
| [1] | Supporting terminals include rxvt-unicode, and Eterm. |







