def output(message, **kwargs):
def repl(match): # pragma: no cover
attr = match.group(0)[2:-1].upper()
if hasattr(colorama.Fore, attr):
return getattr(colorama.Fore, attr)
elif hasattr(colorama.Style, attr):
return getattr(colorama.Style, attr)
else:
return match.group(0)
message, count = re.subn('#{(.+?)}', repl, message)
message = colorama.Style.RESET_ALL + message + colorama.Style.RESET_ALL
print_(message, **kwargs)
评论列表
文章目录