class Console::Terminal::XTerm
def colors?
def colors? true end
def reset
def reset "\e[0m" end
def size
def size @output.winsize rescue Errno::ENOTTY # Fake it... [24, 80] end
def style(foreground, background = nil, *attributes)
def style(foreground, background = nil, *attributes) tokens = [] if foreground tokens << 30 + COLORS.fetch(foreground) end if background tokens << 40 + COLORS.fetch(background) end attributes.each do |attribute| tokens << ATTRIBUTES.fetch(attribute){attribute.to_i} end return "\e[#{tokens.join(';')}m" end
def width
def width size.last end