8000 GitHub - Robpol86/colorclass at v1.0.1
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Dec 13, 2020. It is now read-only.
/ colorclass Public archive

Colorful worry-free console applications for Linux, Mac OS X, and Windows.

License

Notifications You must be signed in to change notification settings

Robpol86/colorclass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

colorclass

Yet another ANSI color text library for Python. Provides "auto colors" for dark/light terminals.

In Python2.x this library subclasses unicode, while on Python3.x it subclasses str. colorclass is supported on Python 2.6, 2.7, 3.3, and 3.4.

[Build Status] (https://travis-ci.org/Robpol86/colorclass) [Coverage Status] (https://coveralls.io/r/Robpol86/colorclass) [Latest Version] (https://pypi.python.org/pypi/colorclass/) [Downloads] (https://pypi.python.org/pypi/colorclass/) [Download format] (https://pypi.python.org/pypi/colorclass/) [License] (https://pypi.python.org/pypi/colorclass/)

Quickstart

Install:

pip install colorclass

Example Implementation

Example Script Screenshot

Source code for the example code is: example.py

Usage

Different colors are chosen using curly-bracket tags, such as {red}{/red}. For a list of available colors, call colorclass.list_tags().

The available "auto colors" tags are:

  • autoblack
  • autored
  • autogreen
  • autoyellow
  • autoblue
  • automagenta
  • autocyan
  • autowhite

Methods of Class instances try to return sane data, such as:

from colorclass import Color
color_string = Color('{red}Test{/red}')

color_string
u'\x1b[31mTest\x1b[39m'

len(color_string)
4

color_string.istitle()
True

There are also a couple of helper attributes for all Color instances:

color_string.value_colors
'\x1b[31mTest\x1b[39m'

color_string.value_no_colors
'Test'

Changelog

1.0.1

  • Fixed splitlines() method.

1.0.0

  • Initial release.

About

Colorful worry-free console applications for Linux, Mac OS X, and Windows.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages

0