switched to colorama which works on Windows and in VS Code

This commit is contained in:
Nicholas Albion
2023-09-27 11:37:15 +10:00
parent 6dd5a032fa
commit af75e8ebdc
4 changed files with 16 additions and 13 deletions

View File

@@ -52,6 +52,7 @@ def get_arguments():
# Handle the error as needed, possibly exiting the script
else:
arguments['app_id'] = str(uuid.uuid4())
# TODO: This intro is also presented by Project.py. This version is not presented in the VS Code extension
print(colored('\n------------------ STARTING NEW PROJECT ----------------------', 'green', attrs=['bold']))
print("If you wish to continue with this project in future run:")
print(colored(f'python {sys.argv[0]} app_id={arguments["app_id"]}', 'green', attrs=['bold']))

View File

@@ -1,45 +1,45 @@
from termcolor import colored
from colorama import Fore, Style
def red(text):
return colored(text, 'red')
return f'{Fore.RED}{text}{Style.RESET_ALL}'
def red_bold(text):
return colored(text, 'red', attrs=['bold'])
return f'{Fore.RED}{Style.BRIGHT}{text}{Style.RESET_ALL}'
def yellow(text):
return colored(text, 'yellow')
return f'{Fore.YELLOW}{text}{Style.RESET_ALL}'
def yellow_bold(text):
return colored(text, 'yellow', attrs=['bold'])
return f'{Fore.YELLOW}{Style.BRIGHT}{text}{Style.RESET_ALL}'
def green(text):
return colored(text, 'green')
return f'{Fore.GREEN}{text}{Style.RESET_ALL}'
def green_bold(text):
return colored(text, 'green', attrs=['bold'])
return f'{Fore.GREEN}{Style.BRIGHT}{text}{Style.RESET_ALL}'
def blue(text):
return colored(text, 'blue')
return f'{Fore.BLUE}{text}{Style.RESET_ALL}'
def blue_bold(text):
return colored(text, 'blue', attrs=['bold'])
return f'{Fore.BLUE}{Style.BRIGHT}{text}{Style.RESET_ALL}'
def cyan(text):
return colored(text, 'light_cyan')
return f'{Fore.CYAN}{text}{Style.RESET_ALL}'
def white(text):
return colored(text, 'white')
return f'{Fore.WHITE}{text}{Style.RESET_ALL}'
def white_bold(text):
return colored(text, 'white', attrs=['bold'])
return f'{Fore.WHITE}{Style.BRIGHT}{text}{Style.RESET_ALL}'