仅彩色文本部分工作

时间:2017-01-22 03:14:13

标签: python python-3.x

当我输入类似的内容时:

print('\x1b[6;30;42m' + 'Success!' + '\x1b[0m')

我得到的输出是:

enter image description here

没有颜色。

我听说你需要为windows启用vt100仿真,但是当我搜索如何做到这一点时,我没有看到任何答案。

非常感谢所有答案!

1 个答案:

答案 0 :(得分:-1)

    printf("\033[1;42m Success! \033[0m \n");

    color as below:
    none = "\033[0m"
    black = "\033[0;30m"
    dark_gray = "\033[1;30m"
    blue = "\033[0;34m"
    light_blue = "\033[1;34m"
    green = "\033[0;32m"
    light_green -= "\033[1;32m"
    cyan = "\033[0;36m"
    light_cyan = "\033[1;36m"
    red = "\033[0;31m"
    light_red = "\033[1;31m"
    purple = "\033[0;35m"
    light_purple = "\033[1;35m"
    brown = "\033[0;33m"
    yellow = "\033[1;33m"
    light_gray = "\033[0;37m"
    white = "\033[1;37m"