Module: Specdiff::Colorize

Included in:
Differ::Hash, Differ::Text
Defined in:
lib/specdiff/colorize.rb

Class Method Summary collapse

Class Method Details

.blue(text) ⇒ Object

this color may have bad contrast



29
30
31
# File 'lib/specdiff/colorize.rb', line 29

def blue(text)
  "\e[34m#{text}\e[0m"
end

.colorize_by_line(string, line_separator = "\n") ⇒ Object



4
5
6
7
8
9
10
# File 'lib/specdiff/colorize.rb', line 4

def (string, line_separator = "\n")
  return string if !::Specdiff.config.colorize?

  string.lines(line_separator).map do |line|
    yield(line)
  end.join
end

.cyan(text) ⇒ Object



33
34
35
# File 'lib/specdiff/colorize.rb', line 33

def cyan(text)
  "\e[36m#{text}\e[0m"
end

.green(text) ⇒ Object



20
21
22
# File 'lib/specdiff/colorize.rb', line 20

def green(text)
  "\e[32m#{text}\e[0m"
end

.red(text) ⇒ Object



16
17
18
# File 'lib/specdiff/colorize.rb', line 16

def red(text)
  "\e[31m#{text}\e[0m"
end

.reset_color(text) ⇒ Object



12
13
14
# File 'lib/specdiff/colorize.rb', line 12

def reset_color(text)
  "\e[0m#{text}"
end

.yellow(text) ⇒ Object



24
25
26
# File 'lib/specdiff/colorize.rb', line 24

def yellow(text)
  "\e[33m#{text}\e[0m"
end