IDLE background color in python

For text window backgrounds, go to Options => IDLE Preferences => Highlighting tab. Save the builtin theme (both are the same) as a custom theme, with a new name. Change the background of each element with a white background to the color you want. Hit Apply or OK. Alternatively, copy the following into <HOMEDIR>/.idlerc/config-highlight.cfg (which may or may not exist already) and change #ffffff to your desired color.

[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

We just added an IDLE Dark theme with a deep cobalt blue background. For this, leave #002240 as is or change to another dark color.

[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

We are planning to add a means to change all the normal backgrounds at once. Being able to affect dialogs will be a later project.


Following are the steps:

  1. Open IDLE
  2. Go to "OPTIONS" in the top tab
  3. Select "Configure IDLE"
  4. Select "Highlights" from top horizontal tab
  5. Select "Background" radio button just above the image of IDLE on the left hand side
  6. On the right hand side under "Highlight Theme" click on "IDLE Classic/IDLE Dark/IDLE New" as per your preference
  7. Click Apply and Then Click OK

    Done!