bpo-33679: IDLE: Re-enable color configuration for code context (GH-7199)
The difference from before is that the settings are now on the
Highlights tab instead of the Extensions tab and only change one theme
at a time instead of all themes. The default for light themes is black
on light gray, as before. The default for the IDLE Dark theme is white
on dark gray, which better fits the dark theme.
When one starts IDLE from a console and loads a custom theme without
definitions for 'context', one will see a warning message on the console.
To stop the warning, go to Options => Configure IDLE => Highlights,
select the custom theme if not selected already, select 'Code Context',
and select foreground and background colors.
(cherry picked from commit de6516264e793be991f692fdd892707afb9104a7)
Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py
index 28ad458..7df69d5 100644
--- a/Lib/idlelib/configdialog.py
+++ b/Lib/idlelib/configdialog.py
@@ -799,19 +799,20 @@
"""
self.theme_elements = {
'Normal Text': ('normal', '00'),
- 'Python Keywords': ('keyword', '01'),
- 'Python Definitions': ('definition', '02'),
- 'Python Builtins': ('builtin', '03'),
- 'Python Comments': ('comment', '04'),
- 'Python Strings': ('string', '05'),
- 'Selected Text': ('hilite', '06'),
- 'Found Text': ('hit', '07'),
- 'Cursor': ('cursor', '08'),
- 'Editor Breakpoint': ('break', '09'),
- 'Shell Normal Text': ('console', '10'),
- 'Shell Error Text': ('error', '11'),
- 'Shell Stdout Text': ('stdout', '12'),
- 'Shell Stderr Text': ('stderr', '13'),
+ 'Code Context': ('context', '01'),
+ 'Python Keywords': ('keyword', '02'),
+ 'Python Definitions': ('definition', '03'),
+ 'Python Builtins': ('builtin', '04'),
+ 'Python Comments': ('comment', '05'),
+ 'Python Strings': ('string', '06'),
+ 'Selected Text': ('hilite', '07'),
+ 'Found Text': ('hit', '08'),
+ 'Cursor': ('cursor', '09'),
+ 'Editor Breakpoint': ('break', '10'),
+ 'Shell Normal Text': ('console', '11'),
+ 'Shell Error Text': ('error', '12'),
+ 'Shell Stdout Text': ('stdout', '13'),
+ 'Shell Stderr Text': ('stderr', '14'),
}
self.builtin_name = tracers.add(
StringVar(self), self.var_changed_builtin_name)
@@ -842,6 +843,7 @@
('\n', 'normal'),
('#you can click here', 'comment'), ('\n', 'normal'),
('#to choose items', 'comment'), ('\n', 'normal'),
+ ('code context section', 'context'), ('\n\n', 'normal'),
('def', 'keyword'), (' ', 'normal'),
('func', 'definition'), ('(param):\n ', 'normal'),
('"""string"""', 'string'), ('\n var0 = ', 'normal'),