when termcolor is missing, fake colored() function can add bold

This commit is contained in:
Romain Bignon 2013-07-27 18:10:14 +02:00
commit 599775b3fb

View file

@ -27,8 +27,11 @@ if sys.platform == 'win32':
try: try:
from termcolor import colored from termcolor import colored
except ImportError: except ImportError:
def colored(s, *args, **kwargs): def colored(s, color=None, on_color=None, attrs=None):
return s if attrs is not None and 'bold' in attrs:
return '%s%s%s' % (IFormatter.BOLD, s, IFormatter.NC)
else:
return s
try: try:
import tty import tty