summaryrefslogtreecommitdiff
path: root/support/optexcount/src/color_print.py
blob: 6ae62facaced6f28c6dd767fd83982032803f36c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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='')