Skip to content
Commits on Source (14)
02-07-2014
Version 1.0.1
[Feature] - Added test
02-07-2014
Version 1.0.0
......
Metadata-Version: 1.1
Name: colored
Version: 1.0.1
Author: dslackw
Author-email: d zlatanidis at gmail com
Maintainer: dslackw
Maintainer-email: d zlatanidis at gmail com
Home-page: https://github.com/dslackw/colored
Summary: Very simple Python library for color and formatting in terminal.
Description: .. image:: https://badge.fury.io/py/colored.png
:target: http://badge.fury.io/py/colored
.. image:: https://pypip.in/d/colored/badge.png
:target: https://pypi.python.org/pypi/colored
.. image:: https://pypip.in/license/colored/badge.png
:target: https://pypi.python.org/pypi/colored
colored
=======
Very simple Python library for color and formatting in terminal.
.. image::
https://raw.githubusercontent.com/dslackw/colored/master/screenshot/screenshot-1.png
:alt: example
The following colors works with most terminals and terminals emulators.
ANSI/VT100 escape sequences can be used in every programming languages.
Set:
.. code-block:: bash
+-----+-------------+
|Code | Description |
+-----+-------------+
| 1 | bold |
| 2 | dim |
| 4 | underlined |
| 5 | blink |
| 7 | reverse |
| 8 | hidden |
+-------------------+
Reset:
.. code-block:: bash
+-----+-------------+
|Code | Description |
+-----+-------------+
| 0 | all |
| 21 | bold |
| 22 | dim |
| 24 | underlined |
| 25 | blink |
| 27 | reverse |
| 28 | hidden |
+-----+-------------+
Foreground (text):
.. code-block:: bash
+-----+---------------+
|Code | Description |
+-----+---------------+
| 39 | default |
| 30 | black |
| 31 | red |
| 32 | green |
| 33 | yellow |
| 34 | blue |
| 35 | magenta |
| 36 | cyan |
| 37 | light_gray |
| 90 | dark_gray |
| 91 | light_red |
| 92 | light_green |
| 93 | light_yellow |
| 94 | light_blue |
| 95 | light_magenta |
| 96 | light_cyan |
| 97 | white |
+-----+---------------+
Background:
.. code-block:: bash
+-----+---------------+
|Code | Description |
+-----+---------------+
| 49 | default |
| 40 | black |
| 41 | red |
| 42 | green |
| 43 | yellow |
| 44 | blue |
| 45 | magenta |
| 46 | cyan |
| 47 | light_gray |
| 100 | dark_gray |
| 101 | light_red |
| 102 | light_green |
| 103 | light_yellow |
| 104 | light_blue |
| 105 | light_magenta |
| 106 | light_cyan |
| 107 | white |
+-----+---------------+
Installation
------------
.. code-block:: bash
$ pip install colored
uninstall
$ pip uninstall colored
Usage Examples
--------------
How to use the module in your own python code:
Modules : colored.fg(), colored.bg(), colored.set(), colored.reset()
.. code-block:: bash
>>> import colored
>>>
>>> red = colored.fg(31)
>>> default = colored.fg(39)
>>> print ('%s Hello World !!! %s') % (red, default)
Hello World !!!
or you car use description:
.. code-block:: bash
>>> green = colored.fg('green')
>>> default = colored.fg('default')
>>> print ('%s Hello World !!! %s') % (green, default)
Hello World !!!
using format method:
.. code-block:: bash
>>> bold = colored.set('bold')
>>> print ('{0}{1} Hello World !!! {3}'.format(green, bold, default))
Hello World !!!
Screenshot:
.. image::
https://raw.githubusercontent.com/dslackw/colored/master/screenshot/screenshot-2.png
:alt: example
Keywords: color termcolor colour terminal linux console ansi
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: POSIX
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: POSIX :: Other
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.0
Classifier: Programming Language :: Python :: 3.1
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Unix Shell
Classifier: Topic :: Terminals
.. image:: https://badge.fury.io/py/colored.png
:target: http://badge.fury.io/py/colored
.. image:: https://pypip.in/d/colored/badge.png
:target: https://pypi.python.org/pypi/colored
.. image:: https://pypip.in/license/colored/badge.png
:target: https://pypi.python.org/pypi/colored
colored
=======
Very simple Python library for color and formatting in terminal.
.. image:: https://raw.githubusercontent.com/dslackw/colored/master/screenshot/screenshot-1.png
.. image:: https://raw.githubusercontent.com/dslackw/colored/master/screenshots/screenshot-1.png
:alt: example
The following colors works with most terminals and terminals emulators.
......@@ -110,6 +119,9 @@ Usage Examples
How to use the module in your own python code:
Modules : colored.fg(), colored.bg(), colored.set(), colored.reset()
.. code-block:: bash
>>> import colored
......@@ -133,8 +145,12 @@ using format method:
.. code-block:: bash
>>> bold = colored.set('bold')
>>> print ('{0}{1} Hello World !!! {3}'.format(green, bold, default))
>>> print ('{0}{1} Hello World !!! {2}'.format(green, bold, default))
Hello World !!!
.. image:: https://raw.githubusercontent.com/dslackw/colored/master/screenshot/screenshot-2.png
Screenshot:
.. image:: https://raw.githubusercontent.com/dslackw/colored/master/screenshots/screenshot-2.png
:alt: example
......@@ -2,4 +2,4 @@ from __future__ import print_function
from .colored import *
__version__ = "1.0.0"
__version__ = "1.0.1"
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''Very simple Python library for color and
formatting in terminal.'''
ESC = '\x1b['
END = 'm'
......
# Python 2, 3
# LInux OS
......@@ -24,11 +24,16 @@ setup(
"Operating System :: POSIX",
"Operating System :: POSIX :: Linux",
"Operating System :: POSIX :: Other",
"Operating System :: Unix",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.0"],
"Programming Language :: Python :: 3.0",
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Unix Shell",
"Topic :: Terminals"],
long_description=open("README.rst").read()
)
#!/usr/bin/python
# -*- coding: utf-8 -*-
import colored
def main():
colors = ('default', 'black', 'red', 'green', 'yellow', 'blue',
'magenta', 'cyan', 'light_gray', 'dark_gray', 'light_red',
'light_green', 'light_yellow', 'light_blue', 'light_magenta',
'light_cyan', 'white')
for color in colors:
print ('%s This text is colored %s%s') % (
colored.fg(color), color, colored.fg('default'))
print ('%s This background is colored %s%s') % (
colored.bg(color), color, colored.bg('default'))
if __name__ == "__main__":
main()