README~20171216-075206.rst 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. ANSI colors for Python
  2. ======================
  3. A simple module to add ANSI colors and decorations to your strings.
  4. Install
  5. --------
  6. python set_up.py install
  7. Example Usage
  8. -------------
  9. You can choose one of the 8 basic ANSI colors: black, red, green, yellow, blue,
  10. magenta, cyan, white.
  11. ::
  12. from colors import red, green, blue
  13. print red('This is red')
  14. print green('This is green')
  15. print blue('This is blue')
  16. Optionally you can specify a background color.
  17. ::
  18. print red('red on blue', bg='blue')
  19. print green('green on black', bg='black')
  20. You can additionally specify one of the supported styles: bold, faint, italic,
  21. underline, blink, blink2, negative, concealed, crossed. Not all styles are
  22. supported by all terminals.
  23. ::
  24. from colors import bold, underline
  25. print bold('This is bold')
  26. print underline('underline red on blue', fg='red', bg='blue')
  27. print green('bold green on black', bg='black', style='bold')
  28. You can also use more than one styles at once.
  29. ::
  30. print red('This is very important', style='bold+underline')
  31. xterm-256 colors are supported as well, to use them give an integer instead of
  32. a color name.
  33. ::
  34. from colors import color
  35. for i in range(256):
  36. print color('Color #%d' % i, fg=i)
  37. License
  38. -------
  39. colors is licensed under the ISC license.