Module: Rdm::Support::Colorize::ClassMethods

Included in:
Rdm::Support::Colorize
Defined in:
lib/rdm/support/colorize.rb

Instance Method Summary collapse

Instance Method Details

#bg_black(msg) ⇒ Object



38
39
40
# File 'lib/rdm/support/colorize.rb', line 38

def bg_black(msg)
  color_wrap(msg, 40)
end

#bg_blue(msg) ⇒ Object



54
55
56
# File 'lib/rdm/support/colorize.rb', line 54

def bg_blue(msg)
  color_wrap(msg, 44)
end

#bg_brown(msg) ⇒ Object



50
51
52
# File 'lib/rdm/support/colorize.rb', line 50

def bg_brown(msg)
  color_wrap(msg, 43)
end

#bg_cyan(msg) ⇒ Object



62
63
64
# File 'lib/rdm/support/colorize.rb', line 62

def bg_cyan(msg)
  color_wrap(msg, 46)
end

#bg_gray(msg) ⇒ Object



66
67
68
# File 'lib/rdm/support/colorize.rb', line 66

def bg_gray(msg)
  color_wrap(msg, 47)
end

#bg_green(msg) ⇒ Object



46
47
48
# File 'lib/rdm/support/colorize.rb', line 46

def bg_green(msg)
  color_wrap(msg, 42)
end

#bg_magenta(msg) ⇒ Object



58
59
60
# File 'lib/rdm/support/colorize.rb', line 58

def bg_magenta(msg)
  color_wrap(msg, 45)
end

#bg_red(msg) ⇒ Object



42
43
44
# File 'lib/rdm/support/colorize.rb', line 42

def bg_red(msg)
  color_wrap(msg, 41)
end

#black(msg) ⇒ Object



6
7
8
# File 'lib/rdm/support/colorize.rb', line 6

def black(msg)
  color_wrap(msg, 30)
end


82
83
84
# File 'lib/rdm/support/colorize.rb', line 82

def blink(msg)
  color_wrap(msg, 5, 25)
end

#blue(msg) ⇒ Object



22
23
24
# File 'lib/rdm/support/colorize.rb', line 22

def blue(msg)
  color_wrap(msg, 34)
end

#bold(msg) ⇒ Object



70
71
72
# File 'lib/rdm/support/colorize.rb', line 70

def bold(msg)
  color_wrap(msg, 1, 22)
end

#brown(msg) ⇒ Object



18
19
20
# File 'lib/rdm/support/colorize.rb', line 18

def brown(msg)
  color_wrap(msg, 33)
end

#color_wrap(msg, from, to = 0) ⇒ Object



90
91
92
# File 'lib/rdm/support/colorize.rb', line 90

def color_wrap(msg, from, to = 0)
  "\e[#{from}m#{msg}\e[#{to}m"
end

#cyan(msg) ⇒ Object



30
31
32
# File 'lib/rdm/support/colorize.rb', line 30

def cyan(msg)
  color_wrap(msg, 36)
end

#gray(msg) ⇒ Object



34
35
36
# File 'lib/rdm/support/colorize.rb', line 34

def gray(msg)
  color_wrap(msg, 37)
end

#green(msg) ⇒ Object



14
15
16
# File 'lib/rdm/support/colorize.rb', line 14

def green(msg)
  color_wrap(msg, 32)
end

#italic(msg) ⇒ Object



74
75
76
# File 'lib/rdm/support/colorize.rb', line 74

def italic(msg)
  color_wrap(msg, 3, 23)
end

#magenta(msg) ⇒ Object



26
27
28
# File 'lib/rdm/support/colorize.rb', line 26

def magenta(msg)
  color_wrap(msg, 35)
end

#no_colors(msg) ⇒ Object



94
95
96
# File 'lib/rdm/support/colorize.rb', line 94

def no_colors(msg)
  msg.gsub(/\e\[\d+m/, '')
end

#red(msg) ⇒ Object



10
11
12
# File 'lib/rdm/support/colorize.rb', line 10

def red(msg)
  color_wrap(msg, 31)
end

#reverse_color(msg) ⇒ Object



86
87
88
# File 'lib/rdm/support/colorize.rb', line 86

def reverse_color(msg)
  color_wrap(msg, 7, 27)
end

#underline(msg) ⇒ Object



78
79
80
# File 'lib/rdm/support/colorize.rb', line 78

def underline(msg)
  color_wrap(msg, 4, 24)
end