我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用colorama.Fore.LIGHTMAGENTA_EX。
def print_after(path): print(Fore.LIGHTBLUE_EX + "\nFolders after cleaning\n" + Fore.RESET) for files in os.listdir(path): print(files, sep=',\t') print(Fore.LIGHTMAGENTA_EX + "\nCLEANED\n" + Fore.RESET)
def formatEntry(e:Entry): R = _S.RESET_ALL ID = R + _B.BLUE P = R + _F.LIGHTGREEN_EX TAG = R + _F.RED NAME = R + _B.RED Bd = R + _F.CYAN PATH = R + _F.YELLOW TITLE = R + _F.LIGHTMAGENTA_EX AUTHORS = R + _F.MAGENTA prefix = Bd + '| ' + R comment = ( s + '\n' + prefix for s in e.comment.split('\n') ) if e.comment != '' else () return ''.join( ( Bd, '--------------------------------------------------------------------------------', R, '\n', prefix, ID, 'ID : ', '{:>5}'.format(e.ID or ''), R, ' '*47, P, '{:>20}'.format(e.priority), R, '\n', prefix, NAME, e.name, R, '\n', prefix, PATH, e.pathstr(), R, '\n', *( ( prefix, TITLE, e.bibtex.get('title', ''), R, '\n', prefix, AUTHORS, e.bibtex.get('author', ''), R, '\n', ) if e.bibtex else ( prefix, TITLE, '<No Bibtex>', R, '\n') ), prefix, (R + ' ').join(''.join((TAG, '#', t)) for t in e.tags), '\n', prefix, R, *comment , '\n', Bd, '--------------------------------------------------------------------------------', R, '\n', ))
def print_after(path): print(Fore.LIGHTBLUE_EX + "\nAfter cleaning\n" + Fore.RESET) for files in os.listdir(path): print(files,end='\t') print(Fore.LIGHTMAGENTA_EX + "\n\nCLEANED\n" + Fore.RESET)
def start_chat(spy): from globals import current_status_message error_message = None # variable for storing error message print Fore.GREEN + "Authentication complete." + Fore.RESET + "\nWelcome " + spy.get_name() + "\n" + "age: ", spy.get_age(), "\nRating: ", spy.get_rating(), "\nOnline: ", spy.get_online(); # displaying menu for user show_menu = True while show_menu: time.sleep(1) menu_choices = Fore.LIGHTMAGENTA_EX + "What do you want to do ?\n" + Fore.RESET + \ Fore.LIGHTMAGENTA_EX + " 1.ADD A STATUS UPDATE \n" + Fore.RESET + \ Fore.LIGHTMAGENTA_EX + " 2.ADD A FRIEND \n" + Fore.RESET + \ Fore.LIGHTMAGENTA_EX + " 3.SEND A SECRET MESSAGE \n" + Fore.RESET + \ Fore.LIGHTMAGENTA_EX + " 4.READ A SECRET MESSAGE \n" + Fore.RESET + \ Fore.LIGHTMAGENTA_EX + " 5.READ CHATS FROM A USER \n" + Fore.RESET + \ Fore.LIGHTMAGENTA_EX + " 6.CLOSE APPLICATION \n " + Fore.RESET result = int(raw_input(menu_choices)) # validating user's input if result == 1: time.sleep(1) current_status_message = add_status(current_status_message) time.sleep(1) print 'your status has been updated to :\n', current_status_message elif result == 2: time.sleep(1) number_of_friends = add_friend() print 'You have %d friends' % number_of_friends show_friends() elif result == 3: time.sleep(1) send_message() elif result == 4: time.sleep(1) read_message() elif result == 5: time.sleep(1) read_chat_history() elif result == 6: show_menu = False time.sleep(1) print Fore.RED + "Application is closed now." else: print "WRONG CHOICE" # exit from application