python 易于阅读的colorama设置

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 易于阅读的colorama设置相关的知识,希望对你有一定的参考价值。

try:
    from colorama import init, Fore, Style
    init()
    RESET = Style.RESET_ALL
    NORMAL = Style.NORMAL
    RED = NORMAL + Fore.RED
    GRN = NORMAL + Fore.GREEN
    YEL = NORMAL + Fore.YELLOW
    BLU = NORMAL + Fore.BLUE
    PUR = NORMAL + Fore.MAGENTA
    CYN = NORMAL + Fore.CYAN
    WHT = NORMAL + Fore.WHITE
    BOLD = Style.BRIGHT
    LT_RED = BOLD + Fore.RED
    LT_GRN = BOLD + Fore.GREEN
    LT_YEL = BOLD + Fore.YELLOW
    LT_BLU = BOLD + Fore.BLUE
    LT_PUR = BOLD + Fore.MAGENTA
    LT_CYN = BOLD + Fore.CYAN
    LT_WHT = BOLD + Fore.WHITE
except ImportError:
    RED = GRN = YEL = BLU = PUR = CYN = WHT = ''
    LT_RED = LT_GRN = LT_YEL = LT_BLU = LT_PUR = LT_CYN = LT_WHT = ''
    NORMAL = BOLD = RESET = ''

以上是关于python 易于阅读的colorama设置的主要内容,如果未能解决你的问题,请参考以下文章

python colorama模块

python colorama模块

python通过colorama模块在控制台输出彩色文字的方法

Python colorama | 详解终端漂亮的彩色打印怎么实现的

Python colorama | 详解终端漂亮的彩色打印怎么实现的

python colorama模块