summaryrefslogtreecommitdiff
path: root/support/optexcount/src/color_print.py
diff options
context:
space:
mode:
Diffstat (limited to 'support/optexcount/src/color_print.py')
-rw-r--r--support/optexcount/src/color_print.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/support/optexcount/src/color_print.py b/support/optexcount/src/color_print.py
new file mode 100644
index 0000000000..6ae62facac
--- /dev/null
+++ b/support/optexcount/src/color_print.py
@@ -0,0 +1,29 @@
+class Printer:
+ """
+ Class for printing string with specific color
+ Color list: blue, green, cyan, red, white
+ """
+ def __init__(self):
+ self.__BLUE = '\033[1;34;48m'
+ self.__GREEN = '\033[1;32;48m'
+ self.__CYAN = '\033[1;36;48m'
+ self.__RED = '\033[1;31;48m'
+ self.__TERM = '\033[1;37;0m'
+
+ def print_c(self, text, color):
+ print(color + text + self.__TERM, end='')
+
+ def blue(self, text):
+ self.print_c(text, self.__BLUE)
+
+ def green(self, text):
+ self.print_c(text, self.__GREEN)
+
+ def cyan(self, text):
+ self.print_c(text, self.__CYAN)
+
+ def red(self, text):
+ self.print_c(text, self.__RED)
+
+ def white(self, text):
+ print(text, end='')