module ShellColors
Outputs the input in technicolour, for a happier terminal.
Useful list of colour codes misc.flogisoft.com/bash/tip_colors_and_formatting
And alternatives stackoverflow.com/questions/1108767/terminal-color-in-ruby
Public Class Methods
blue(txt)
click to toggle source
# File lib/bbc/shell/colors.rb, line 28 def blue(txt) paint(txt, 34) end
cyan(txt)
click to toggle source
# File lib/bbc/shell/colors.rb, line 32 def cyan(txt) paint(txt, 36) end
green(txt)
click to toggle source
# File lib/bbc/shell/colors.rb, line 20 def green(txt) paint(txt, 32) end
light_green(txt)
click to toggle source
# File lib/bbc/shell/colors.rb, line 40 def light_green(txt) paint(txt, 92) end
paint(txt, color)
click to toggle source
# File lib/bbc/shell/colors.rb, line 12 def paint(txt, color) "\033[#{color}m#{txt}\033[0m" end
red(txt)
click to toggle source
# File lib/bbc/shell/colors.rb, line 16 def red(txt) paint(txt, 31) end
white(txt)
click to toggle source
# File lib/bbc/shell/colors.rb, line 36 def white(txt) paint(txt, 37) end
yellow(txt)
click to toggle source
# File lib/bbc/shell/colors.rb, line 24 def yellow(txt) paint(txt, 33) end
Private Instance Methods
blue(txt)
click to toggle source
# File lib/bbc/shell/colors.rb, line 28 def blue(txt) paint(txt, 34) end
cyan(txt)
click to toggle source
# File lib/bbc/shell/colors.rb, line 32 def cyan(txt) paint(txt, 36) end
green(txt)
click to toggle source
# File lib/bbc/shell/colors.rb, line 20 def green(txt) paint(txt, 32) end
light_green(txt)
click to toggle source
# File lib/bbc/shell/colors.rb, line 40 def light_green(txt) paint(txt, 92) end
paint(txt, color)
click to toggle source
# File lib/bbc/shell/colors.rb, line 12 def paint(txt, color) "\033[#{color}m#{txt}\033[0m" end
red(txt)
click to toggle source
# File lib/bbc/shell/colors.rb, line 16 def red(txt) paint(txt, 31) end
white(txt)
click to toggle source
# File lib/bbc/shell/colors.rb, line 36 def white(txt) paint(txt, 37) end
yellow(txt)
click to toggle source
# File lib/bbc/shell/colors.rb, line 24 def yellow(txt) paint(txt, 33) end