Textformat-ruby is a lightweight ruby library 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' module 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.rbto your project
The test.rb file shows how you can use the library.
Below are also some examples:
format = Text::Format.new
puts format.green("Hello World!")
puts format.green("Multiline example", true)
puts "Test"
puts "Hello" + format.disable_multiline
puts "Normal"
puts format.bold(format.underline(format.red("Error Message:")))- port to other languages when finished
If some errors appears please write a issue that I can fix it.
MIT