Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

cli-textformat-py

Textformat-py is a lightweight python module to write colored and formated code onto the linux terminal/cli.
It is capusled as good as possible to has no overhead for the library user and uses the 'Text' class as namespace.

Motivation

I was inspired by this stackoverflow post to make a good color/simple format library for Ruby error and test messages on linux terminal.

Features

  • Coloring text (black, red, green, yellow, blue, magenta, cyan, white)
    • foreground and background support
  • bold, underline and inverse text
  • multiline support

Installation

  • Copy src/textformat.py to your project

Examples

The test.py file shows how you can use the library.

Below are also some examples:

from src.textformat import Text

print(Text.green("Hello World!"))
print(Text.green("Multiline example", true))
print("Test")
print("Hello" + Text.disable_multiline()) 
print("Normal")
print(Text.bold(Text.underline(Text.red("Error Message:"))))

Testing

This application was testet with xterm and KDE konsole terminals

If the colors are not equal with the method names please check your personal settings on your terminal.

TODO

  • port to other languages when finished

Support

If some errors appears please write a issue that I can fix it.

See also

License

MIT