summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/output.py65
1 files changed, 21 insertions, 44 deletions
diff --git a/pym/output.py b/pym/output.py
index f23bac263..e735d4d47 100644
--- a/pym/output.py
+++ b/pym/output.py
@@ -132,47 +132,24 @@ def nocolor():
def resetColor():
return codes["reset"]
-def ctext(color,text):
- return codes[ctext]+text+codes["reset"]
-
-def bold(text):
- return codes["bold"]+text+codes["reset"]
-def white(text):
- return bold(text)
-
-def teal(text):
- return codes["teal"]+text+codes["reset"]
-def turquoise(text):
- return codes["turquoise"]+text+codes["reset"]
-def darkteal(text):
- return turquoise(text)
-
-def fuscia(text): # Don't use this one. It's spelled wrong!
- return codes["fuchsia"]+text+codes["reset"]
-def fuchsia(text):
- return codes["fuchsia"]+text+codes["reset"]
-def purple(text):
- return codes["purple"]+text+codes["reset"]
-
-def blue(text):
- return codes["blue"]+text+codes["reset"]
-def darkblue(text):
- return codes["darkblue"]+text+codes["reset"]
-
-def green(text):
- return codes["green"]+text+codes["reset"]
-def darkgreen(text):
- return codes["darkgreen"]+text+codes["reset"]
-
-def yellow(text):
- return codes["yellow"]+text+codes["reset"]
-def brown(text):
- return codes["brown"]+text+codes["reset"]
-def darkyellow(text):
- return brown(text)
-
-def red(text):
- return codes["red"]+text+codes["reset"]
-def darkred(text):
- return codes["darkred"]+text+codes["reset"]
-
+def colorize(color_key, text):
+ return codes[color_key] + text + codes["reset"]
+
+codes["darkteal"] = codes["turquoise"]
+codes["darkyellow"] = codes["brown"]
+codes["fuscia"] = codes["fuchsia"]
+codes["white"] = codes["bold"]
+
+compat_functions_colors = ["bold","white","teal","turquoise","darkteal",
+ "fuscia","fuchsia","purple","blue","darkblue","green","darkgreen","yellow",
+ "brown","darkyellow","red","darkred"]
+
+def create_color_func(color_key):
+ def derived_func(*args):
+ newargs = list(args)
+ newargs.insert(0, color_key)
+ return colorize(*newargs)
+ return derived_func
+
+for c in compat_functions_colors:
+ setattr(sys.modules[__name__], c, create_color_func(c))