Skip to content

Commit 9044c00

Browse files
authored
Merge pull request #7 from aduskett/add-dark-mode-compatibility
Add dark mode compatibility
2 parents 4f68b44 + 30240b7 commit 9044c00

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/objdictgen/ui/subindextable.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,13 @@ def SetValue(self, row, col, value):
157157
value = "None"
158158
self.data[row][colname] = value
159159

160+
def setCellTheme(self, row, col, grid):
161+
system_appearance = wx.SystemSettings.GetAppearance()
162+
background_colour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
163+
text_colour = wx.WHITE if system_appearance.IsDark() else wx.BLACK
164+
grid.SetCellBackgroundColour(row, col, background_colour)
165+
grid.SetCellTextColour(row, col, text_colour)
166+
160167
def ResetView(self, grid):
161168
"""
162169
(wx.grid.Grid) -> Reset the grid view. Call this to
@@ -266,8 +273,7 @@ def _updateColAttrs(self, grid):
266273

267274
grid.SetCellEditor(row, col, editor)
268275
grid.SetCellRenderer(row, col, renderer)
269-
270-
grid.SetCellBackgroundColour(row, col, wx.WHITE)
276+
self.setCellTheme(row, col, grid)
271277

272278
def SetData(self, data):
273279
self.data = data

0 commit comments

Comments
 (0)