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.
I was inspired by this stackoverflow post to make a good color/simple format library for Ruby error and test messages on linux terminal.
- Coloring text (black, red, green, yellow, blue, magenta, cyan, white)
- foreground and background support
- bold, underline and inverse text
- multiline support
- Copy
src/textformat.pyto your project
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:"))))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.
- port to other languages when finished
If some errors appears please write a issue that I can fix it.
MIT