(s, color, prompt=False, colors_enabled=True)
return res
color a string using ansi escape characters. set prompt to true to add marks for readline to see invisible portions of the prompt
	cf. http://stackoverflow.com/questions/9468435/look-how-to-fix-column-calculation-in-python-readline-if-use-color-prompt
color a string using ansi escape characters. set prompt to true to add marks for readline to see invisible portions of the prompt
	cf. http://stackoverflow.com/questions/9468435/look-how-to-fix-column-calculation-in-python-readline-if-use-color-prompt
color a string using ansi escape characters . set prompt to true to add marks for readline to see invisible portions of the prompt cf . http : // stackoverflow . com / questions / 9468435 / look - how - to - fix - column - calculation - in - python - readline - if - use - color - prompt
def color_real(s, color, prompt=False, colors_enabled=True):
	""" color a string using ansi escape characters. set prompt to true to add marks for readline to see invisible portions of the prompt
	cf. http://stackoverflow.com/questions/9468435/look-how-to-fix-column-calculation-in-python-readline-if-use-color-prompt"""
	if s is None:
		return ""
	s=str(s)
	if not colors_enabled:
		return s
	res=s
	COLOR_STOP="\033[0m"
	prompt_stop=""
	prompt_start=""
	if prompt:
		prompt_stop="\002"
		prompt_start="\001"
	if prompt:
		COLOR_STOP=prompt_start+COLOR_STOP+prompt_stop
	if color.lower()=="random":
		color=random.choice(["blue","red","green","yellow"])
	if color.lower()=="blue":
		res=prompt_start+"\033[34m"+prompt_stop+s+COLOR_STOP
	if color.lower()=="red":
		res=prompt_start+"\033[31m"+prompt_stop+s+COLOR_STOP
	if color.lower()=="green":
		res=prompt_start+"\033[32m"+prompt_stop+s+COLOR_STOP
	if color.lower()=="yellow":
		res=prompt_start+"\033[33m"+prompt_stop+s+COLOR_STOP
	if color.lower()=="grey":
		res=prompt_start+"\033[37m"+prompt_stop+s+COLOR_STOP
	if color.lower()=="darkgrey":
		res=prompt_start+"\033[1;30m"+prompt_stop+s+COLOR_STOP
	return res
def color_real ( s , color , prompt = False , colors_enabled = True ) : if s is None : return "" s = str ( s ) if not colors_enabled : return s res = s COLOR_STOP = "\033[0m" prompt_stop = "" prompt_start = "" if prompt : prompt_stop = "\002" prompt_start = "\001" if prompt : COLOR_STOP = prompt_start + COLOR_STOP + prompt_stop if color . lower ( ) == "random" : color = random . choice ( [ "blue" , "red" , "green" , "yellow" ] ) if color . lower ( ) == "blue" : res = prompt_start + "\033[34m" + prompt_stop + s + COLOR_STOP if color . lower ( ) == "red" : res = prompt_start + "\033[31m" + prompt_stop + s + COLOR_STOP if color . lower ( ) == "green" : res = prompt_start + "\033[32m" + prompt_stop + s + COLOR_STOP if color . lower ( ) == "yellow" : res = prompt_start + "\033[33m" + prompt_stop + s + COLOR_STOP if color . lower ( ) == "grey" : res = prompt_start + "\033[37m" + prompt_stop + s + COLOR_STOP if color . lower ( ) == "darkgrey" : res = prompt_start + "\033[1;30m" + prompt_stop + s + COLOR_STOP return res