Skip to main content

console colouring for python

Project description

http://gfxmonk.net/dist/status/project/termstyle.png

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.

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

python-termstyle-0.1.10.tgz (2.9 kB view details)

Uploaded Source

python-termstyle-0.1.10.tar.gz (4.1 kB view details)

Uploaded Source

File details

Details for the file python-termstyle-0.1.10.tgz.

File metadata

File hashes

Hashes for python-termstyle-0.1.10.tgz
Algorithm Hash digest
SHA256 6faf42ba42f2826c38cf70dacb3ac51f248a418e48afc0e36593df11cf3ab1d2
MD5 1ffe4a4fa86448f2a5fec0036ae21802
BLAKE2b-256 d3ec47c1b7b91e948cc67e23bd496225f80ff8896d4fa82800cadb3674068dd8

See more details on using hashes here.

File details

Details for the file python-termstyle-0.1.10.tar.gz.

File metadata

File hashes

Hashes for python-termstyle-0.1.10.tar.gz
Algorithm Hash digest
SHA256 f42a6bb16fbfc5e2c66d553e7ad46524ea833872f75ee5d827c15115fafc94e2
MD5 1b227cebbeda209029252420af72e5c7
BLAKE2b-256 b3b097086bb087d660cbdb9c0b0dbaa0548ebd9ba9d5e4701bc09b862228110d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page