Skip to content

Fix light rendering of grids and Settings dialog in dark mode#650

Merged
Hirogen merged 4 commits into
Developmentfrom
darkmode-gridview
Jul 9, 2026
Merged

Fix light rendering of grids and Settings dialog in dark mode#650
Hirogen merged 4 commits into
Developmentfrom
darkmode-gridview

Conversation

@Hirogen

@Hirogen Hirogen commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator
image

Dark mode (Application.SetColorMode) remaps SystemColors, but anything painted by the Windows visual-style renderer only exists in a light flavor. Two symptoms of that plus some hardcoded light-mode colors:

  • Grid column headers stayed lightEnableHeadersVisualStyles was left at its default. New PaintHelper.ApplyGridViewTheme disables it in dark mode; wired via PaintHelper.SetColumnizer so all grids get it (main, filter, Bookmark window, Pattern window), plus the three grids in the Settings dialog.
  • Settings dialog tab pages were lightUseVisualStyleBackColor = true paints the page body light while child controls inherit the dark ambient color. New PaintHelper.ApplyTabControlTheme flips it off in dark mode.
  • Hardcoded paint fallbacks — cells for lines matching no highlight rule got white background/black text regardless of theme; the unfocused-selection brush was a fixed light gray; GetDataGridViewCellStyle had white-on-white ForeColor. All PaintHelper color helpers now take an explicit darkMode parameter (call sites pass Application.IsDarkModeEnabled), keeping them pure and unit-testable.

18 new tests in PaintHelperTests. Light-mode behavior unchanged.

@Hirogen Hirogen linked an issue Jul 9, 2026 that may be closed by this pull request
@Hirogen
Hirogen merged commit 49cdfb8 into Development Jul 9, 2026
1 check passed
@Hirogen
Hirogen deleted the darkmode-gridview branch July 9, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dark mode is broken

1 participant