Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IDLE background color in python

Is there a way to change background color of python-3.5 IDLE under windows 10? I've tried google and reading docs, but i can't find the answer. I'm not sure it's even possible...

like image 300
Laszlowaty Avatar asked Oct 11 '15 11:10

Laszlowaty


People also ask

How do I change the background color in python?

Right-click the upper-left corner of the Python console window and select Properties. In the dialog box that appears, pick the tab labeled Colors. On it you can set the screen background and text color.

Does Python Idle have dark mode?

You can also configure idle to work in dark mode or theme, which is a great feature to have, especially when you want to code for longer duration and give some relief to your eyes. By default, idle works in classic mode and can be tuned to work in a dark mode.


2 Answers

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.

like image 78
Terry Jan Reedy Avatar answered Sep 22 '22 20:09

Terry Jan Reedy


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!

like image 26
Megha Chovatiya Avatar answered Sep 22 '22 20:09

Megha Chovatiya