Module: Tui::ANSI

Defined in:
lib/tui.rb

Constant Summary collapse

CLEAR_EOL =
"\e[K"
CLEAR_EOS =
"\e[J"
CLEAR_SCREEN =
"\e[2J"
HOME =
"\e[H"
HIDE =
"\e[?25l"
SHOW =
"\e[?25h"
"\e[1 q"
CURSOR_STEADY =

Steady block cursor

"\e[2 q"
CURSOR_DEFAULT =

Reset cursor to terminal default

"\e[0 q"
ALT_SCREEN_ON =

Enter alternate screen buffer

"\e[?1049h"
ALT_SCREEN_OFF =

Return to main screen buffer

"\e[?1049l"
RESET =
"\e[0m"
RESET_FG =
"\e[39m"
RESET_BG =
"\e[49m"
RESET_INTENSITY =
"\e[22m"
BOLD =
"\e[1m"
DIM =
"\e[2m"

Class Method Summary collapse

Class Method Details

.bg(code) ⇒ Object



68
69
70
# File 'lib/tui.rb', line 68

def bg(code)
  "\e[48;5;#{code}m"
end

.fg(code) ⇒ Object



64
65
66
# File 'lib/tui.rb', line 64

def fg(code)
  "\e[38;5;#{code}m"
end

.move_col(col) ⇒ Object



72
73
74
# File 'lib/tui.rb', line 72

def move_col(col)
  "\e[#{col}G"
end

.sgr(*codes) ⇒ Object



76
77
78
79
# File 'lib/tui.rb', line 76

def sgr(*codes)
  joined = codes.flatten.join(";")
  "\e[#{joined}m"
end