Skip to content

Commit 13405db

Browse files
committed
some more prep for dark/light mode
1 parent 839926d commit 13405db

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

larch/wxlib/wxcolors.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
pass
1313

1414

15-
COLORS = {'text': wx.Colour(0, 0, 0),
15+
COLORS_LIGHT = {'text': wx.Colour(0, 0, 0),
1616
'text_bg': wx.Colour(255, 255, 255),
1717
'text_invalid': wx.Colour(240, 0, 10),
1818
'text_invalid_bg': wx.Colour(253, 253, 90),
@@ -39,8 +39,7 @@
3939
'pt_bgsel': wx.Colour(250, 250, 200),
4040
}
4141

42-
if DARK_THEME:
43-
COLORS = {'text': wx.Colour(255, 255, 255),
42+
COLORS_DARK = {'text': wx.Colour(255, 255, 255),
4443
'text_bg': wx.Colour(25, 25, 25),
4544
'text_invalid': wx.Colour(240, 0, 10),
4645
'text_unused': wx.Colour(230, 230, 30),
@@ -67,6 +66,7 @@
6766
'pt_bgsel': wx.Colour(30, 20, 80),
6867
}
6968

69+
COLORS = COLORS_DARK if DARK_THEME else COLORS_LIGHT
7070

7171
X11_COLORS = {'aliceblue': (240,248,255), 'antiquewhite': (250,235,215),
7272
'antiquewhite1': (255,239,219), 'antiquewhite2': (238,223,204),

larch/wxxas/xasgui.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,8 +829,16 @@ def createMenus(self):
829829
self.menubar.Append(hmenu, '&Help')
830830
self.SetMenuBar(self.menubar)
831831
self.Bind(wx.EVT_CLOSE, self.onClose)
832-
832+
self.Bind(wx.EVT_SYS_COLOUR_CHANGED, self.onSystemDarkMode)
833+
834+
def onSystemDarkMode(self, event=None):
835+
"""notify on light/dark mode change"""
836+
appear = wx.SystemSettings.GetAppearance()
837+
isdark = appear.isDark()
838+
# would set light/dark mode
839+
833840
def onwxInspect(self, evt=None):
841+
"wx inspection tool"
834842
wx.GetApp().ShowInspectionTool()
835843

836844
def onShowLarchBuffer(self, evt=None):

0 commit comments

Comments
 (0)