forked from cmccabe/linkulator2
Merge branch 'style-function' of cmccabe/linkulator2 into master
This commit is contained in:
commit
1a0732c607
16
linkulator
16
linkulator
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue