With Concolor
you can change the fore- and background colors and text decorations when rendering text on terminals supporting ANSI escape codes. It adds the concolor
method to String
objects.
Gem development information and current project status:
Just install the concolor gem
gem install concolor
or if you use bundler put this in your Gemfile
gem 'concolor'
require 'concolor'
puts 'Some text'.concolor(:bold, :red)
# "\033[31;1mSome text\033[0m"
Symbol | Description | code |
---|---|---|
:reset |
Reset all SGR effects to their default | 0 |
:bold |
Bold or increased intensity | 1 |
:faint |
Faint or decreased intensity | 2 |
:italic |
Italic | 3 |
:underline |
Singly underlined | 4 |
:blink |
Blink (slow) | 5 |
:blink_fast |
Blink (fast) | 6 |
:reverse |
Reverse (invert the foreground and background colors) | 7 |
:hide |
Hidden (useful for passwords) | 8 |
:cross |
Cross-out | 9 |