Debian Codegraph @

texmf-dist/source/support/optexcount/color_print.py

raw
1 class Printer:
2 """
3 Class for printing string with specific color
4 Color list: blue, green, cyan, red, white
5 """
6 def __init__(self):
7 self.__BLUE = '\033[1;34;48m'
8 self.__GREEN = '\033[1;32;48m'
9 self.__CYAN = '\033[1;36;48m'
10 self.__RED = '\033[1;31;48m'
11 self.__TERM = '\033[1;37;0m'
12
13 def print_c(self, text, color):
14 print(color + text + self.__TERM, end='')
15
16 def blue(self, text):
17 self.print_c(text, self.__BLUE)
18
19 def green(self, text):
20 self.print_c(text, self.__GREEN)
21
22 def cyan(self, text):
23 self.print_c(text, self.__CYAN)
24
25 def red(self, text):
26 self.print_c(text, self.__RED)
27
28 def white(self, text):
29 print(text, end='')