Spiffup
Make your stdout shine
Presentation
This library provides means to 'prettify' output in Ruby.
Installation
Gemfile
gem 'spiffup'
Terminal
gem install -V spiffup
Usage
Output colorization via tags
Output can be colorized simply by adding tags within the text: The RST tag can be used to reset the color. Bold text can be produced by using the 'BXXX' tag constants (BGREEN, BRED, ...).
require 'spiffup'
puts "This is #{Spiffup::GREEN}green#{Spiffup::RST}"
Direct string colorization
Entire strings can be directly colorized by using the monkey-patched methods .red, .green, .blue, ... Also available are .bred, .bgreen, .bblue methods for bold text.
require 'spiffup'
currency = 'CHF'
amount = 52.4
price = "#{amount} #{currency}"
puts "Total price: #{price.green}"
Available Colors
The 8 classical terminal colors are available as the following:
- black
- red
- green
- brown
- blue
- magenta
- cyan
- gray
License
The gem is available as open source under the terms of the MIT License.