首页 > 代码库 > Python背景色与语法高亮主题配置

Python背景色与语法高亮主题配置

使用python idle的人恐怕都无法忍受默认的白色背景,及其语法高亮主题。

大家更倾向于使用黑色背景。

 

用户目录 的.idlerc 目录:

下面的各个系统下对应的该文件的位置:在Linux系列系统下路径为(~表示用户目录):~/.idlerc/在Windows XP下路径为:C:/Documents and Settings/<用户名>/.idlerc/在Windows 7下路径为:C:/Users/<用户名>/.idlerc/
在window下,可以直接在运行框中输入下面的路径定位到位置:%USERPROFILE%/.idlerc/有时候会发现目录中没有config-highlight.cfg文件,那么自己就创建一个:在Linux下:# for Linuxvi ~/.idlerc/config-highlight.cfg在window下:notepad %USERPROFILE%/.idlerc/config-highlight.cfg

 

下面介绍Obsidian, Desert, 和Tango三种主题配置

在 用户目录 的.idlerc 目录下新建名为 config-highlight.cfg 文件,并加入如下内容

[tango]definition-foreground = #fce94ferror-foreground = #fa8072string-background = #2e3436keyword-foreground = #8cc4ffnormal-foreground = #ffffffcomment-background = #2e3436hit-foreground = #ffffffbreak-foreground = #000000builtin-background = #2e3436stdout-foreground = #eeeeeccursor-foreground = #fce94fhit-background = #2e3436comment-foreground = #73d216hilite-background = #edd400definition-background = #2e3436stderr-background = #2e3436break-background = #2e3436console-foreground = #87ceebnormal-background = #2e3436builtin-foreground = #ad7fa8stdout-background = #2e3436console-background = #2e3436stderr-foreground = #ff3e40keyword-background = #2e3436string-foreground = #e9b96ehilite-foreground = #2e3436error-background = #2e3436[desert]definition-foreground = #98fb98error-foreground = #ff0000string-background = #333333keyword-foreground = #cc6600normal-foreground = #f0e68ccomment-background = #333333hit-foreground = #ffffffbreak-foreground = blackbuiltin-background = #333333stdout-foreground = #eeeeeecursor-foreground = #ffcc00hit-background = #333333comment-foreground = #87ceebhilite-background = graydefinition-background = #333333stderr-background = #333333break-background = #ffff55console-foreground = #87ceebnormal-background = #333333builtin-foreground = #519e51stdout-background = #333333console-background = #333333stderr-foreground = #ff3e40keyword-background = #333333string-foreground = #ffa0a0hilite-foreground = #000000error-background = #000000[Obsidian]definition-foreground = #678CB1error-foreground = #FF0000string-background = #293134keyword-foreground = #93C763normal-foreground = #E0E2E4comment-background = #293134hit-foreground = #E0E2E4builtin-background = #293134stdout-foreground = #678CB1cursor-foreground = #E0E2E4break-background = #293134comment-foreground = #66747Bhilite-background = #2F393Chilite-foreground = #E0E2E4definition-background = #293134stderr-background = #293134hit-background = #000000console-foreground = #E0E2E4normal-background = #293134builtin-foreground = #E0E2E4stdout-background = #293134console-background = #293134stderr-foreground = #FB0000keyword-background = #293134string-foreground = #EC7600break-foreground = #E0E2E4error-background = #293134

重启IDLE,依次选 Options -> Configure IDLE -> Highlighting 如下图

技术分享

 

有童鞋要问字体怎么配置?这个容易,在Highlighting选项卡旁边有个Fonts/Tabs选项卡,可以用来配置字体和缩进宽度的:

技术分享

Python背景色与语法高亮主题配置