colorama

Cross-platform colored terminal text in Python
Download

colorama Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Price:
  • FREE
  • Publisher Name:
  • Jonathan Hartley
  • Publisher web site:
  • http://code.google.com/u/@WBVQRlJTAxZGWwY=/

colorama Tags


colorama Description

Cross-platform colored terminal text in Python colorama provides a simple cross-platform API to print colored terminal text from Python applications.ANSI escape character sequences are commonly used to produce colored terminal text on Macs and Unix. Colorama provides some shortcuts to generate these sequences, and makes them work on Windows too.This has the happy side-effect that existing applications or libraries which already use ANSI sequences to produce colored output on Linux or Macs (eg. using packages like 'termcolor') can now also work on Windows, simply by importing and initialising Colorama.StatusIn development. Some features, as noted below, are not implemented yet.UsageInitialisationApplications should initialise Colorama using:from colorama import initinit()If you are on Windows, the call to ''init()'' will start filtering ANSI escape sequences out of any text sent to stdout or stderr, and will replace them with equivalent Win32 calls.Calling ''init()'' has no effect on other platforms (unless you use 'autoreset', see below) The intention is that all applications should call init() unconditionally, then their colored text output simply works on all platforms.Colored OutputCross-platform printing of colored text can then be done:from colorama import Fore, Back, Styleprint Fore.RED + 'some red text'print Back.GREEN + and with a green background'print Style.DIM + 'and in dim text'print + Fore.DEFAULT + Back.DEFAULT + Style.DEFAULTprint 'back to normal now'or simply by manually printing ANSI sequences from your own code:print '/033 · Stop emulating 'bright' text with bright backgrounds. Display 'normal' text using win32 normal foreground instead of bright. Drop support for 'dim' text.


colorama Related Software