Module: Vedeu::EscapeSequences::Foreground

Extended by:
Forwardable, Foreground
Included in:
Esc, Foreground
Defined in:
lib/vedeu/esc/foreground.rb

Overview

Provides foreground colour related escape sequences.

See esc

Instance Method Summary collapse

Instance Method Details

#black(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


20
21
22
# File 'lib/vedeu/esc/foreground.rb', line 20

def black(&block)
  foreground("\e[30m", &block)
end

#blue(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


44
45
46
# File 'lib/vedeu/esc/foreground.rb', line 44

def blue(&block)
  foreground("\e[34m", &block)
end

#cyan(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


56
57
58
# File 'lib/vedeu/esc/foreground.rb', line 56

def cyan(&block)
  foreground("\e[36m", &block)
end

#dark_grey(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


74
75
76
# File 'lib/vedeu/esc/foreground.rb', line 74

def dark_grey(&block)
  foreground("\e[90m", &block)
end

#default(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


68
69
70
# File 'lib/vedeu/esc/foreground.rb', line 68

def default(&block)
  foreground("\e[39m", &block)
end

#foreground(sequence, &block) ⇒ String (private)

Parameters:

  • sequence (String)

    The colour escape sequence.

  • block (Proc)

Returns:

  • (String)


125
126
127
128
129
130
131
132
133
# File 'lib/vedeu/esc/foreground.rb', line 125

def foreground(sequence, &block)
  if block_given?
    sequence + yield + fg_reset

  else
    sequence

  end
end

#green(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


32
33
34
# File 'lib/vedeu/esc/foreground.rb', line 32

def green(&block)
  foreground("\e[32m", &block)
end

#light_blue(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


98
99
100
# File 'lib/vedeu/esc/foreground.rb', line 98

def light_blue(&block)
  foreground("\e[94m", &block)
end

#light_cyan(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


110
111
112
# File 'lib/vedeu/esc/foreground.rb', line 110

def light_cyan(&block)
  foreground("\e[96m", &block)
end

#light_green(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


86
87
88
# File 'lib/vedeu/esc/foreground.rb', line 86

def light_green(&block)
  foreground("\e[92m", &block)
end

#light_grey(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


62
63
64
# File 'lib/vedeu/esc/foreground.rb', line 62

def light_grey(&block)
  foreground("\e[37m", &block)
end

#light_magenta(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


104
105
106
# File 'lib/vedeu/esc/foreground.rb', line 104

def light_magenta(&block)
  foreground("\e[95m", &block)
end

#light_red(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


80
81
82
# File 'lib/vedeu/esc/foreground.rb', line 80

def light_red(&block)
  foreground("\e[91m", &block)
end

#light_yellow(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


92
93
94
# File 'lib/vedeu/esc/foreground.rb', line 92

def light_yellow(&block)
  foreground("\e[93m", &block)
end

#magenta(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


50
51
52
# File 'lib/vedeu/esc/foreground.rb', line 50

def magenta(&block)
  foreground("\e[35m", &block)
end

#red(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


26
27
28
# File 'lib/vedeu/esc/foreground.rb', line 26

def red(&block)
  foreground("\e[31m", &block)
end

#white(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


116
117
118
# File 'lib/vedeu/esc/foreground.rb', line 116

def white(&block)
  foreground("\e[97m", &block)
end

#yellow(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


38
39
40
# File 'lib/vedeu/esc/foreground.rb', line 38

def yellow(&block)
  foreground("\e[33m", &block)
end