您的位置:首頁技術文章
文章詳情頁

如何更換python默認編輯器的背景色

瀏覽:20日期:2022-07-14 15:59:49

初學Python,想必大家拿來練習最多的IDE就是Python自帶的IDLE了,但是默認的代碼配色及語法高亮主題確實很不適應。下面我們就來看一下修改python默認編輯器背景顏色的方法。

1、首先要找到名為config-highlight.cfg的文件

在Linux系列系統下路徑為(~表示用戶目錄):

~/.idlerc/

在Windows XP下路徑為:

C:Documents and Settings<用戶名>.idlerc

在Windows 7下路徑為:

C:Users<用戶名>.idlerc

對于Windows可以直接打開開始運行或者在地址欄輸入下面的路徑確認即可:

%USERPROFILE%.idlerc找到這個名叫config-highlight.cfg文件后接下來就需要編輯它了

打開文件后,你會看到一些默認的顏色配置,比如經典的顏色配置就是白色背景,一般這個文件中會有兩種配置可供選擇:

[IDLE Classic]和[IDLE New]

表現在IDLE界面上就是在python shell下,選擇options—configure IDLE—-highlighting選項中,右側的highlighting theme主題選擇。

如果直接在源文件上修改顏色有些麻煩,除非你特別熟悉顏色。網上有經典的背景配置:

[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[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

直接把上面的代碼copy到剛才打開的config-highlight.def文件中,然后重啟shell就可以。

重啟后,shell會默認選擇原來的。你就在highlighting theme主題中查看,此時已經多了兩種主題,就是你剛才添加的。

如何更換python默認編輯器的背景色

到此這篇關于如何更換python默認編輯器的背景色的文章就介紹到這了,更多相關python默認編輯器的背景色更換方法內容請搜索好吧啦網以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持好吧啦網!

標簽: Python 編程
相關文章:
国产综合久久一区二区三区