def colored(r, g, b, text):
return "33[38;2;{};{};{}m{} 33[38;2;255;255;255m".format(r, g, b, text)
text = 'Hello, World'
colored_text = colored(255, 0, 0, text)
print(colored_text)
#or
print(colored(255, 0, 0, 'Hello, World'))
#colors
ResetAll = "33[0m"
Bold = "33[1m"
Dim = "33[2m"
Underlined = "33[4m"
Blink = "33[5m"
Reverse = "33[7m"
Hidden = "33[8m"
ResetBold = "33[21m"
ResetDim = "33[22m"
ResetUnderlined = "33[24m"
ResetBlink = "33[25m"
ResetReverse = "33[27m"
ResetHidden = "33[28m"
Default = "33[39m"
Black = "33[30m"
Red = "33[31m"
Green = "33[32m"
Yellow = "33[33m"
Blue = "33[34m"
Magenta = "33[35m"
Cyan = "33[36m"
LightGray = "33[37m"
DarkGray = "33[90m"
LightRed = "33[91m"
LightGreen = "33[92m"
LightYellow = "33[93m"
LightBlue = "33[94m"
LightMagenta = "33[95m"
LightCyan = "33[96m"
White = "33[97m"
from colorama import init
from colorama import Fore
init()
print(Fore.BLUE + 'Hello')
print(Fore.RED + 'Hello')
print(Fore.YELLOW + 'Hello')
print(Fore.GREEN + 'Hello')
print(Fore.WHITE + 'Hello')
#test in vscode
#code by fawlid
import colorama
from colorama import Fore
print(Fore.RED + 'This text is red in color')
#example
print("33[1;31mHello World!33[0m")
print("33[<properties>;<color>m")
Black 30 No effect 0 Black 40
Red 31 Bold 1 Red 41
Green 32 Underline 2 Green 42
Yellow 33 Negative1 3 Yellow 43
Blue 34 Negative2 5 Blue 44
Purple 35 Purple 45
Cyan 36 Cyan 46
White 37 White 47
from colorama import Fore, Back, Style
print(Fore.RED + "red")
print(Style.RESET_ALL)
def print_format_table():
"""
prints table of formatted text format options
"""
for style in range(8):
for fg in range(30,38):
s1 = ''
for bg in range(40,48):
format = ';'.join([str(style), str(fg), str(bg)])
s1 += 'x1b[%sm %s x1b[0m' % (format, format)
print(s1)
print('
')
print_format_table()
from termcolor import colored
print(colored('python', 'green', attrs=['bold']))
import colorama
from colorama import Fore
print(Fore.RED + 'This text is red in color')