Fore和Back的顺序分别是
BLACK BLUE CYAN GREEN LIGHTBLACK_EX LIGHTBLUE_EX LIGHTCYAN_EX LIGHTGREEN_EX LIGHTMAGENTA_EX LIGHTRED_EX LIGHTWHITE_EX LIGHTYELLOW_EX MAGENTA RED WHITE YELLOW RESET
Style.BRIGHT
Style.DIM
Style.NORMAL
from colorama import Style, Fore, Back
str_colors = ['BLACK', 'BLUE', 'CYAN', 'GREEN', 'LIGHTBLACK_EX', 'LIGHTBLUE_EX', 'LIGHTCYAN_EX', 'LIGHTGREEN_EX',
'LIGHTMAGENTA_EX', 'LIGHTRED_EX', 'LIGHTWHITE_EX', 'LIGHTYELLOW_EX', 'MAGENTA', 'RED', 'WHITE',
'YELLOW', 'RESET']
str_styles = ['BRIGHT', 'DIM', 'NORMAL']
fore_colors = [Fore.BLACK, Fore.BLUE, Fore.CYAN, Fore.GREEN, Fore.LIGHTBLACK_EX, Fore.LIGHTBLUE_EX, Fore.LIGHTCYAN_EX,
Fore.LIGHTGREEN_EX, Fore.LIGHTMAGENTA_EX, Fore.LIGHTRED_EX, Fore.LIGHTWHITE_EX, Fore.LIGHTYELLOW_EX,
Fore.MAGENTA, Fore.RED, Fore.WHITE, Fore.YELLOW, Fore.RESET]
back_colors = [Back.BLACK, Back.BLUE, Back.CYAN, Back.GREEN, Back.LIGHTBLACK_EX, Back.LIGHTBLUE_EX, Back.LIGHTCYAN_EX,
Back.LIGHTGREEN_EX, Back.LIGHTMAGENTA_EX, Back.LIGHTRED_EX, Back.LIGHTWHITE_EX, Back.LIGHTYELLOW_EX,
Back.MAGENTA, Back.RED, Back.WHITE, Back.YELLOW, Back.RESET]
styles = [Style.BRIGHT, Style.DIM, Style.NORMAL]
for k in range(len(styles)):
print(str_colors)
color_str1 = styles[k]
for j in range(len(back_colors)):
color_str2 = color_str1 + back_colors[j]
for i in range(len(fore_colors)):
color_str2 = color_str2 + fore_colors[i] + 'ABC'
color_str2 = color_str2 + Back.RESET + Fore.RESET + ' '
print(color_str2)
版权声明:本文为devmole原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。