1'''
2Install colorama by typing this in the terminal:
3python -m pip install colorama
4'''
5
6# Importing Colorama
7import colorama
8from colorama import Fore
9from colorama import Back
10from colorama import Style
11
12# Initialising Colorama (Important)
13colorama.init(autoreset=True)
14
15# Colored Text
16print(f"{Fore.RED}Red Text")
17print(f"{Fore.GREEN}Green Text")
18print(f"{Fore.YELLOW}Yellow Text")
19print(f"{Fore.BLUE}Blue Text")
20print(f"{Fore.MAGENTA}Magenta Text")
21print(f"{Fore.CYAN}Cyan Text")
22print(f"{Fore.WHITE}White Text")
23
24# Backgrounds
25print(f"{Back.RED}Red Background")
26print(f"{Back.GREEN}Green Background")
27print(f"{Back.YELLOW}Yellow Background")
28print(f"{Back.BLUE}Blue Background")
29print(f"{Back.MAGENTA}Magenta Background")
30print(f"{Back.CYAN}Cyan Background")
31print(f"{Back.WHITE}White Background")
32
33# Styles
34print(f"{Style.DIM}Dim Text")
35print(f"{Style.NORMAL}Normal Text")
36print(f"{Style.BRIGHT}Bright Text")
37
38# Combining Colored Text, Backgrounds and Styles
39print(f"{Fore.GREEN}{Back.YELLOW}{Style.BRIGHT}Green Text - Yellow Background - Bright")
40print(f"{Fore.CYAN}{Back.WHITE}{Style.DIM}Cyan Text - White Background - Dim")
41
42
43'''
44Fore: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET.
45Back: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET.
46Style: DIM, NORMAL, BRIGHT, RESET_ALL
47'''
1pip install simple-colors
2
3from simple_colors import *
4
5print(green('hello'))
6print(green('hello', 'bold'))
7print(green('hello', ['bold', 'underlined']))
1from colorama import init, Fore, Back, Style
2init()
3
4print("normal")
5print(Fore.LIGHTYELLOW + "yellow" + Fore.RESET)
6print(Back.RED + "red" + Back.RESET)
7print(Fore.YELLOW + Back.RED + "both" + Style.RESET_ALL)
8print("normal again")
9
10
11
12The possible colors are: BLACK, BLUE, CYAN, GREEN, LIGHTBLACK_EX,
13 LIGHTBLUE_EX, LIGHTCYAN_EX, LIGHTGREEN_EX, LIGHTMAGENTA_EX, LIGHTRED_EX,
14 LIGHTWHITE_EX, LIGHTYELLOW_EX, MAGENTA, RED, WHITE, YELLOW
1CEND = '\33[0m'
2CBOLD = '\33[1m'
3CITALIC = '\33[3m'
4CURL = '\33[4m'
5CBLINK = '\33[5m'
6CBLINK2 = '\33[6m'
7CSELECTED = '\33[7m'
8
9CBLACK = '\33[30m'
10CRED = '\33[31m'
11CGREEN = '\33[32m'
12CYELLOW = '\33[33m'
13CBLUE = '\33[34m'
14CVIOLET = '\33[35m'
15CBEIGE = '\33[36m'
16CWHITE = '\33[37m'
17
18CBLACKBG = '\33[40m'
19CREDBG = '\33[41m'
20CGREENBG = '\33[42m'
21CYELLOWBG = '\33[43m'
22CBLUEBG = '\33[44m'
23CVIOLETBG = '\33[45m'
24CBEIGEBG = '\33[46m'
25CWHITEBG = '\33[47m'
26
27CGREY = '\33[90m'
28CRED2 = '\33[91m'
29CGREEN2 = '\33[92m'
30CYELLOW2 = '\33[93m'
31CBLUE2 = '\33[94m'
32CVIOLET2 = '\33[95m'
33CBEIGE2 = '\33[96m'
34CWHITE2 = '\33[97m'
35
36CGREYBG = '\33[100m'
37CREDBG2 = '\33[101m'
38CGREENBG2 = '\33[102m'
39CYELLOWBG2 = '\33[103m'
40CBLUEBG2 = '\33[104m'
41CVIOLETBG2 = '\33[105m'
42CBEIGEBG2 = '\33[106m'
43CWHITEBG2 = '\33[107m'
1print("\033[0;37;40m Normal text\n")
2print("\033[2;37;40m Underlined text\033[0;37;40m \n")
3print("\033[1;37;40m Bright Colour\033[0;37;40m \n")
4print("\033[3;37;40m Negative Colour\033[0;37;40m \n")
5print("\033[5;37;40m Negative Colour\033[0;37;40m\n")
6
7print("\033[1;37;40m \033[2;37:40m TextColour BlackBackground TextColour GreyBackground WhiteText ColouredBackground\033[0;37;40m\n")
8print("\033[1;30;40m Dark Gray \033[0m 1;30;40m \033[0;30;47m Black \033[0m 0;30;47m \033[0;37;41m Black \033[0m 0;37;41m")
9print("\033[1;31;40m Bright Red \033[0m 1;31;40m \033[0;31;47m Red \033[0m 0;31;47m \033[0;37;42m Black \033[0m 0;37;42m")
10print("\033[1;32;40m Bright Green \033[0m 1;32;40m \033[0;32;47m Green \033[0m 0;32;47m \033[0;37;43m Black \033[0m 0;37;43m")
11print("\033[1;33;40m Yellow \033[0m 1;33;40m \033[0;33;47m Brown \033[0m 0;33;47m \033[0;37;44m Black \033[0m 0;37;44m")
12print("\033[1;34;40m Bright Blue \033[0m 1;34;40m \033[0;34;47m Blue \033[0m 0;34;47m \033[0;37;45m Black \033[0m 0;37;45m")
13print("\033[1;35;40m Bright Magenta \033[0m 1;35;40m \033[0;35;47m Magenta \033[0m 0;35;47m \033[0;37;46m Black \033[0m 0;37;46m")
14print("\033[1;36;40m Bright Cyan \033[0m 1;36;40m \033[0;36;47m Cyan \033[0m 0;36;47m \033[0;37;47m Black \033[0m 0;37;47m")
15print("\033[1;37;40m White \033[0m 1;37;40m \033[0;37;40m Light Grey \033[0m 0;37;40m \033[0;37;48m Black \033[0m 0;37;48m")
16
17\n")
18
1const (
2 ResetAll = "\033[0m"
3
4 Bold = "\033[1m"
5 Dim = "\033[2m"
6 Underlined = "\033[4m"
7 Blink = "\033[5m"
8 Reverse = "\033[7m"
9 Hidden = "\033[8m"
10
11 ResetBold = "\033[21m"
12 ResetDim = "\033[22m"
13 ResetUnderlined = "\033[24m"
14 ResetBlink = "\033[25m"
15 ResetReverse = "\033[27m"
16 ResetHidden = "\033[28m"
17
18 Default = "\033[39m"
19 Black = "\033[30m"
20 Red = "\033[31m"
21 Green = "\033[32m"
22 Yellow = "\033[33m"
23 Blue = "\033[34m"
24 Magenta = "\033[35m"
25 Cyan = "\033[36m"
26 LightGray = "\033[37m"
27 DarkGray = "\033[90m"
28 LightRed = "\033[91m"
29 LightGreen = "\033[92m"
30 LightYellow = "\033[93m"
31 LightBlue = "\033[94m"
32 LightMagenta = "\033[95m"
33 LightCyan = "\033[96m"
34 White = "\033[97m"
35
36 BackgroundDefault = "\033[49m"
37 BackgroundBlack = "\033[40m"
38 BackgroundRed = "\033[41m"
39 BackgroundGreen = "\033[42m"
40 BackgroundYellow = "\033[43m"
41 BackgroundBlue = "\033[44m"
42 BackgroundMagenta = "\033[45m"
43 BackgroundCyan = "\033[46m"
44 BackgroundLightGray = "\033[47m"
45 BackgroundDarkGray = "\033[100m"
46 BackgroundLightRed = "\033[101m"
47 BackgroundLightGreen = "\033[102m"
48 BackgroundLightYellow = "\033[103m"
49 BackgroundLightBlue = "\033[104m"
50 BackgroundLightMagenta = "\033[105m"
51 BackgroundLightCyan = "\033[106m"
52 BackgroundWhite = "\033[107m"
53)