Class: Color

Inherits:
Object
  • Object
show all
Defined in:
lib/color.rb

Class Method Summary collapse

Class Method Details

.c(num) ⇒ Object



25
26
27
# File 'lib/color.rb', line 25

def c(num)
  print "\e[#{num.to_s}m"
end

.set(str) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/color.rb', line 5

def set(str)
  case str
  when 'reset'
    c 0
  when 'red'
    c 31
  when 'green'
    c 32
  when 'yellow'
    c 33
  when 'blue'
    c 34
  when 'magenta'
    c 35
  when 'cyan'
    c 36
  when 'white'
    c 37
  end
end