python3.13交互式编译器新增颜色的自定义修改

重装python ing,什么,更新3.13了,搞个玩玩,看眼更新

让我试试

不行,我要自己改这配色,去研究了下源码

这个配色是通过ANSI序列的CSI序列实现的,在Python313\Lib目录下有个文件_colorize.py,里面有个class ANSIColors,里面记录了内置的CSI序列内容

修改这个就可改配色了,除了RESET = "\x1b[0m"都可以改。

关于CSI序列的部分用法:'['和'm'间的数字是CSI序列的参数,其他都是CSI序列的格式,30~40是前景颜色,也就是显示的文字的颜色。'1;31'中的1表示高亮,从表现上可以让文字更亮一点。也支持24位的RGB,如'\033[38;2;176;255;255m',后三串就是RGB

我自己搞的几套配色仅供参考,垃圾审美见谅,我修改了的部分用了\033和\x1b同义,都可以

class ANSIColors:
BOLD_GREEN = "\x1b[1;32m"
BOLD_MAGENTA = "\x1b[1;36m"
BOLD_RED = "\x1b[1;31m"
GREEN = "\x1b[32m"
GREY = "\x1b[90m"
MAGENTA = "\x1b[36m"
RED = "\x1b[31m"
RESET = "\x1b[0m"
YELLOW = "\x1b[33m"

class ANSIColors:
BOLD_GREEN = "\x1b[1;32m"
BOLD_MAGENTA = "\033[38;2;255;135;198m"
BOLD_RED = "\x1b[1;31m"
GREEN = "\x1b[32m"
GREY = "\x1b[90m"
MAGENTA = "\033[38;2;176;255;255m"
RED = "\x1b[31m"
RESET = "\x1b[0m"
YELLOW = "\x1b[33m"

class ANSIColors:
BOLD_GREEN = "\x1b[1;32m"
BOLD_MAGENTA = "\033[38;2;187;255;255m"
BOLD_RED = "\x1b[1;31m"
GREEN = "\x1b[32m"
GREY = "\x1b[90m"
MAGENTA = "\033[38;2;64;255;170m"
RED = "\x1b[31m"
RESET = "\x1b[0m"
YELLOW = "\x1b[33m"

点赞

发表回复

电子邮件地址不会被公开。必填项已用 * 标注