代码如下,可以作为模板加入自己代码中:
from colorama import Fore, Back, Style
def print_hetaoist_welcome_msg():
__AUTHOR__ = 'ღ Tao He'
__JOB_NUMBER__ = '♫ xxxxxxxxx'
__LOC__ = '✈ Shenzhen, China'
__CONTACT__ = '✉ hello.tao@outlook.com'
__git__ = '☺ http://github.com/herobot/<app_name>'
__DATE__ = '✍ 2020/11/23 12:00:00'
__VERSION__ = '☑ 1.0.0'
print(Back.BLACK + '-'*100 + Style.RESET_ALL)
print(Fore.LIGHTMAGENTA_EX + Style.BRIGHT + ' <APP_NAME> ' + Style.RESET_ALL +
Fore.LIGHTMAGENTA_EX + '- API interface designed for XX function.' + Style.RESET_ALL)
print(' Author : ' + Fore.LIGHTCYAN_EX + Style.BRIGHT + __AUTHOR__ + Style.RESET_ALL)
print(' JobID : ' + Fore.LIGHTBLUE_EX + Style.BRIGHT + __JOB_NUMBER__ + Style.RESET_ALL)
print(' Loc : ' + Fore.LIGHTWHITE_EX + Style.BRIGHT + __LOC__ + Style.RESET_ALL)
print(' Contact: ' + Fore.LIGHTGREEN_EX + Style.BRIGHT + __CONTACT__ + Style.RESET_ALL)
print(' Star : ' + Fore.LIGHTYELLOW_EX + Style.BRIGHT + __git__ + Style.RESET_ALL)
print(' At : ' + Fore.LIGHTCYAN_EX + Style.BRIGHT + __DATE__ + Style.RESET_ALL)
print(' Ver. : ' + Fore.LIGHTRED_EX + Style.BRIGHT + __VERSION__ + Style.RESET_ALL)
print(Back.BLACK + '-'*100 + Style.RESET_ALL)
# print('\n')
print_hetaoist_welcome_msg()
信息输出如下(复制的没颜色信息,实际显示有颜色):
<APP_NAME> - API interface designed for XX function.
Author : ღ Tao He
JobID : ♫ xxxxxxxxxx
Loc : ✈ Shenzhen, China
Contact: ✉ hello.tao@outlook.com
Star : ☺ http://github.com/herobot/<app_name>
At : ✍ 2020/11/23 12:00:00
Ver. : ☑ 1.0.0