Skip to content
Commits on Source (7)
04-07-2014
Version 1.0.4
[Feature] - Added test_2.py
03-07-2014
Version 1.0.3
......
Metadata-Version: 1.1
Name: colored
Version: 1.0.3
Version: 1.0.4
Author: dslackw
Author-email: d zlatanidis at gmail com
Maintainer: dslackw
......
......@@ -126,14 +126,30 @@ Installation
$ pip uninstall colored
Dependencies
------------
None, only Python progmamming language.
Usage Examples
--------------
How to use the module in your own python code:
Modules : colored.fg(), colored.fg256(), colored.bg(), colored.bg256(), colored.set(),
colored.reset()
Functions
---------
.. code-block:: bash
colored.fg() Change foreground color,
colored.fg256() Change foreground color using 256 colors,
colored.bg() Change background color,
colored.bg256() Change background color using 256 colors,
colored.set() Set attribute combinations,
colored.reset() Reset attributes
Initialisation
--------------
.. code-block:: bash
......@@ -144,7 +160,7 @@ colored.reset()
>>> print ('%s Hello World !!! %s') % (red, default)
Hello World !!!
or you car use description:
Use description:
.. code-block:: bash
......@@ -153,7 +169,7 @@ or you car use description:
>>> print ('%s Hello World !!! %s') % (green, default)
Hello World !!!
using format method:
Using format method:
.. code-block:: bash
......@@ -161,7 +177,7 @@ using format method:
>>> print ('{0}{1} Hello World !!! {2}'.format(green, bold, default))
Hello World !!!
print 256 colors:
Print 256 colors:
.. code-block:: bash
......
......@@ -5,4 +5,5 @@ from __future__ import print_function
from .colored import *
__version__ = "1.0.3"
__version__ = "1.0.4"
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''test foreground and background colors'''
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()
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''test foreground 256 colors'''
import colored
import time
def main():
fg = colored.fg256
'''create short name'''
for i in range(255):
print fg(i) + ('colored ' * i)
time.sleep(0.1)
print colored.reset(0)
'''back all attributes to default'''
if __name__ == "__main__":
main()