Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,971 questions

51,913 answers

573 users

How to print colored text in Python

2 Answers

0 votes
import colorama
from colorama import Fore
from colorama import Style

colorama.init()

print(Fore.GREEN + "Fore.GREEN" + Style.RESET_ALL)
print(Fore.BLUE + Style.DIM + "Fore.BLUE + Style.DIM" + Style.RESET_ALL)
print(Fore.YELLOW + "Fore.YELLOW" + Style.RESET_ALL)
print(Fore.BLUE + Style.BRIGHT + "Fore.BLUE + Style.BRIGHT" + Style.RESET_ALL)



'''
run:

Fore.GREEN
Fore.BLUE + Style.DIM
Fore.YELLOW
Fore.BLUE + Style.BRIGHT

'''

 



answered Apr 10, 2021 by avibootz
0 votes
class ccolors:
    GREEN = '\033[92m' 
    YELLOW = '\033[93m'
    RED = '\033[91m'
    RESET = '\033[0m' 



print(ccolors.GREEN + "ccolors.GREEN" + ccolors.RESET)
print(ccolors.YELLOW + "ccolors.YELLOW" + ccolors.RESET)
print(ccolors.RED + "ccolors.RED" + ccolors.RESET)




'''
run:

ccolors.GREEN
ccolors.YELLOW
ccolors.RED

'''

 



answered Apr 10, 2021 by avibootz

Related questions

1 answer 71 views
1 answer 72 views
72 views asked Jul 18, 2024 by avibootz
1 answer 302 views
1 answer 214 views
...