Issue #27117: Make colorizer htest and turtledemo work with dark theme.

Factor out code for configuring text widget colors to a new function.
This commit is contained in:
Terry Jan Reedy 2016-05-29 01:40:22 -04:00
parent 82069612ec
commit 2bac3b778f
3 changed files with 31 additions and 16 deletions

View file

@ -90,7 +90,7 @@ helpDialog = HelpDialog() # singleton instance, no longer used
class EditorWindow(object):
from idlelib.percolator import Percolator
from idlelib.colorizer import ColorDelegator
from idlelib.colorizer import ColorDelegator, color_config
from idlelib.undo import UndoDelegator
from idlelib.iomenu import IOBinding, filesystemencoding, encoding
from idlelib import mainmenu
@ -742,20 +742,7 @@ class EditorWindow(object):
# Called from self.filename_change_hook and from configdialog.py
self._rmcolorizer()
self._addcolorizer()
theme = idleConf.CurrentTheme()
normal_colors = idleConf.GetHighlight(theme, 'normal')
cursor_color = idleConf.GetHighlight(theme, 'cursor', fgBg='fg')
select_colors = idleConf.GetHighlight(theme, 'hilite')
self.text.config(
foreground=normal_colors['foreground'],
background=normal_colors['background'],
insertbackground=cursor_color,
selectforeground=select_colors['foreground'],
selectbackground=select_colors['background'],
)
if TkVersion >= 8.5:
self.text.config(
inactiveselectbackground=select_colors['background'])
EditorWindow.color_config(self.text)
IDENTCHARS = string.ascii_letters + string.digits + "_"