7

有没有办法在 windows 10 下更改 python-3.5 IDLE 的背景颜色?我试过谷歌和阅读文档,但我找不到答案。我不确定这是否可能......

4

4 回答 4

12

对于文本窗口背景,转到选项 => 空闲首选项 => 突出显示选项卡。将内置主题(两者相同)另存为自定义主题,并使用新名称。将具有白色背景的每个元素的背景更改为您想要的颜色。点击应用或确定。或者,将以下内容复制到<HOMEDIR>/.idlerc/config-highlight.cfg(可能已经存在也可能不存在)并更改#ffffff为您想要的颜色。

[Custom Light]
normal-foreground= #000000
normal-background= #ffffff
keyword-foreground= #ff7700
keyword-background= #ffffff
builtin-foreground= #900090
builtin-background= #ffffff
comment-foreground= #dd0000
comment-background= #ffffff
string-foreground= #00aa00
string-background= #ffffff
definition-foreground= #0000ff
definition-background= #ffffff
hilite-foreground= #000000
hilite-background= gray
break-foreground= black
break-background= #ffff55
hit-foreground= #ffffff
hit-background= #000000
error-foreground= #000000
error-background= #ff7777
#cursor (only foreground can be set, restart IDLE)
cursor-foreground= black
#shell window
stdout-foreground= blue
stdout-background= #ffffff
stderr-foreground= red
stderr-background= #ffffff
console-foreground= #770000
console-background= #ffffff

我们刚刚添加了一个带有深钴蓝色背景的 IDLE Dark 主题。为此,请#002240保持原样或更改为另一种深色。

[Custom Dark]
comment-foreground = #dd0000
console-foreground = #ff4d4d
error-foreground = #FFFFFF
hilite-background = #7e7e7e
string-foreground = #02ff02
stderr-background = #002240
stderr-foreground = #ffb3b3
console-background = #002240
hit-background = #fbfbfb
string-background = #002240
normal-background = #002240
hilite-foreground = #FFFFFF
keyword-foreground = #ff8000
error-background = #c86464
keyword-background = #002240
builtin-background = #002240
break-background = #808000
builtin-foreground = #ff00ff
definition-foreground = #5e5eff
stdout-foreground = #c2d1fa
definition-background = #002240
normal-foreground = #FFFFFF
cursor-foreground = #ffffff
stdout-background = #002240
hit-foreground = #002240
comment-background = #002240
break-foreground = #FFFFFF

我们计划添加一种方法来一次更改所有正常背景。能够影响对话将是一个以后的项目。

于 2015-10-11T21:41:45.037 回答
9

以下是步骤:

  1. 打开空闲
  2. 转到顶部选项卡中的“选项”
  3. 选择“配置空闲”
  4. 从顶部水平选项卡中选择“亮点”
  5. 选择左侧 IDLE 图像上方的“背景”单选按钮
  6. 在“突出主题”下的右侧,根据您的喜好单击“IDLE Classic/IDLE Dark/IDLE New”
  7. 单击应用,然后单击确定

    完毕!

于 2018-06-12T13:39:14.270 回答
1

遵循这些步骤并保护您的眼睛。

  1. 从安装 Python 时选择的路径打开 Python 文件夹。在这种情况下,它是( C:\Python27 )

  2. 在 Python27 文件夹中,搜索 Lib 并双击它。

  3. 在 Lib 文件夹中,搜索 idlelib 文件夹并双击它。

  4. 在 idlelib 文件夹中,搜索 CONFIG-HIGHLIGHT.DEF 文件并使用任何文本编辑器工具(如记事本)打开它。

  5. 在 CONFIG-HIGHLIGHT.DEF 文件中,粘贴下面给出的 Monokai 代码。保存并关闭文件。

    [monokai]
    
    normal-foreground= #F8F8F2
    normal-background= #272822
    keyword-foreground= #F92672
    keyword-background= #272822
    builtin-foreground= #66D9EF
    builtin-background= #272822
    comment-foreground= #75715E
    comment-background= #272822
    string-foreground= #E6DB74
    string-background= #272822
    definition-foreground= #A6E22E
    definition-background= #272822
    hilite-foreground= #F8F8F2
    hilite-background= gray
    break-foreground= black
    break-background= #ffff55
    hit-foreground= #F8F8F2
    hit-background= #171812
    error-foreground= #ff3338
    error-background= #272822
    cursor-foreground= #F8F8F2
    stdout-foreground= #DDDDDD
    stdout-background= #272822
    stderr-foreground= #ff3338
    stderr-background= #272822
    console-foreground= #75715E
    console-background= #272822       
    

资料来源:CodeHexz

祝所有夜猫子都开心 :)

于 2020-05-13T11:07:58.750 回答
0

用于空闲的深色背景

Daniel Puiu 和 Megha Chovatiya 的上述回答非常好。我听从他们的指示,并有一些额外的个人经验,我也想分享:

此说明将详细说明,可以申请自定义版本:

打开空闲

  1. 转到顶部选项卡中的“选项”
  2. 选择“配置空闲”
  3. 从顶部水平选项卡中选择“亮点”

***因为我想让 IDLE 背景变暗所以在 Highligting 主题 -> 内置主题 -> 点击“IDLE class”更改为“IDLE dark”

  1. 有一个小编码图片,您可以点击选择您要更改颜色的具体编码参数。然后:

    • 如果要更改似乎是 word 文档中突出显示颜色的文本的背景,请选择“背景”单选按钮

    • 或者选择“前景”来调整文字的颜色

和“选择颜色”来选择你想要的颜色。您可以同时查看编码图片以查看您的更改

  1. 当您感觉良好时,单击“应用”并命名自定义。

此外,您可以通过以下方式更改文本大小或加粗文本:

从顶部水平选项卡转到“字体/选项卡”并按照您的样式更改文本

于 2021-08-25T10:06:39.930 回答