diff --git a/src/objdictgen/ui/subindextable.py b/src/objdictgen/ui/subindextable.py index f7257de..9133664 100644 --- a/src/objdictgen/ui/subindextable.py +++ b/src/objdictgen/ui/subindextable.py @@ -174,7 +174,14 @@ def SetValue(self, row, col, value): value = "None" self.data[row][colname] = value - def ResetView(self, grid: wx.grid.Grid): + def setCellTheme(self, row, col, grid): + system_appearance = wx.SystemSettings.GetAppearance() + background_colour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW) + text_colour = wx.WHITE if system_appearance.IsDark() else wx.BLACK + grid.SetCellBackgroundColour(row, col, background_colour) + grid.SetCellTextColour(row, col, text_colour) + + def ResetView(self, grid): """ (wx.grid.Grid) -> Reset the grid view. Call this to update the grid if rows and columns have been added or deleted @@ -289,8 +296,7 @@ def _updateColAttrs(self, grid: wx.grid.Grid): grid.SetCellEditor(row, col, editor) grid.SetCellRenderer(row, col, renderer) - - grid.SetCellBackgroundColour(row, col, wx.WHITE) + self.setCellTheme(row, col, grid) def SetData(self, data): self.data = data