class Async::Terminal

Styled terminal output. **Internal Use Only**

def color(foreground, background = nil, attributes = nil)

def color(foreground, background = nil, attributes = nil)
	return nil unless tty?
	
	buffer = String.new
	
	buffer << "\e["
	first = true
	
	if attributes
		buffer << (attributes).to_s
		first = false
	end
	
	if foreground
		if !first
			buffer << ";" 
		else
			first = false
		end
		
		buffer << (30 + foreground).to_s
	end
	
	if background
		if !first
			buffer << ";" 
		else
			first = false
		end
		
		buffer << (40 + background).to_s
	end
	
	buffer << 'm'
	
	return buffer
end

def initialize(output)

def initialize(output)
	@output = output
end

def reset

def reset
	return nil unless tty?
	
	return "\e[0m"
end

def tty?

def tty?
	@output.isatty
end