Skip to content
Snippets Groups Projects
Commit a4ca3823 authored by Seblu's avatar Seblu
Browse files

Print color only on a tty

parent dbd2d9d0
No related branches found
No related tags found
No related merge requests found
......@@ -47,7 +47,10 @@ def out(message="", fd=sys.stdout, endl=os.linesep, flush=True):
'''
# color subsitution
for c in color:
message = message.replace("#%s#" % c, color[c])
if fd.isatty():
message = message.replace("#%s#" % c, color[c])
else:
message = message.replace("#%s#" % c, "")
# printing
fd.write("%s%s" % (message, endl))
if flush:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment