Merge branch 'style-function' of cmccabe/linkulator2 into master

This commit is contained in:
cmccabe 2019-11-23 22:45:36 -05:00 committed by Gitea
commit 1a0732c607
1 changed files with 16 additions and 0 deletions

View File

@ -402,6 +402,22 @@ def parse_command():
else:
print("Unknown command: {}".format(args[0]))
def style_text(text, *args):
styles = {
"bold": "\033[1m",
"dim": "\033[2m",
"underline": "\033[4m",
"blink": "\033[5m", # This is here if you REALLY need it...dont use it
"inverse": "\033[7m" # Make fg and bg color swap
}
out = ""
for arg in args:
if arg in styles:
out += styles[arg]
out += text
out += "\033[0m"
return out
if __name__ == "__main__":
parse_command()