ui: theme-aware list-control colours (drop hardcoded *wxBLACK/BLUE/RED) - #179
Merged
Merged
Conversation
PR amule-project#128 fixed the *wxBLUE sweep in muuli_wdr.cpp's dialog stat labels but didn't touch the custom DC drawing inside the list controls. Two classes of bug were left in src/GenericClientListCtrl.cpp and src/SearchListCtrl.cpp: 1. Hardcoded text / pen colours that render fine on the default light theme but are unreadable on Adwaita-dark / macOS dark / KDE Breeze Dark. 2. SearchListCtrl's state-coding logic that overlays per-channel tints (`green = 255` for DOWNLOADED, `red = 255` for QUEUED, ...) on top of a base initialised from wxSYS_COLOUR_WINDOWTEXT. On light themes the base is black so the tints produce green / red / magenta as intended; on dark themes the base is white-ish, so the channel assignments are no-ops and *every state collapses to the same colour* -- the semantic cue disappears entirely. Five sites updated: - GenericClientListCtrl.cpp:1004 + :1008 (A4AF badge text + border) -> wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT). Pure decoration, no semantic meaning -- just needs to be readable. - GenericClientListCtrl.cpp:1042 (queue rank decreased, was *wxBLUE) -> hand-tuned blue per theme: (120,170,255) on dark, (0,80,200) on light. - GenericClientListCtrl.cpp:1045 (queue rank increased, was *wxRED) -> hand-tuned red per theme: (255,100,100) on dark, (220,0,0) on light. - GenericClientListCtrl.cpp:1130 (filename mismatch, was *wxRED) -> same red palette as above. - SearchListCtrl.cpp::362-389 (search result state palette) -> replace the channel-tweak logic with explicit per-state palette branching: DOWNLOADED green (80,220,80) / (0,160,0) QUEUED red (255,100,100) / (220,0,0) CANCELED magenta (255,120,200) / (180,0,180) new blue gradient by source count, inverted on dark Primitive used at every draw / refresh site: const bool isDark = wxSystemSettings::GetAppearance().IsDark(); Called per-paint, not cached at startup -- a runtime theme toggle takes effect on the next list refresh. wxSystemAppearance::IsDark() queries: - macOS: NSAppearance bestMatchFromAppearancesWithNames against the dark aqua appearance. - Windows: AppsUseLightTheme registry value. - wxGTK: gtk-application-prefer-dark-theme, with WCAG-style luminance of wxSYS_COLOUR_WINDOW as fallback. Available since wxWidgets 3.1.3, so safely in our 3.2 minimum. Three other call sites surveyed and intentionally left alone: - CaptchaGenerator.cpp:53 (*wxBLACK on *wxWHITE_BRUSH bitmap) drawing onto a known-white surface; theme is irrelevant. - DownloadListCtrl.cpp:1035 / :1037 (wxWHITE / wxBLACK for the percentage label over the progress bar) contrast keyed off the bar's own hardcoded fill colour, not the system background. Closes amule-project#177
Closed
|
All five are cleared. Thanks |
got3nks
added a commit
that referenced
this pull request
Jul 2, 2026
) (#276) * fix(ui): key list-ctrl palette off actual background, not IsDark() (#274) PR #179 keyed the theme-aware palette off wxSystemSettings::GetAppearance().IsDark(). On macOS + wxGTK that matches what the native wxListCtrl actually paints — dark mode propagates to the list background — so the light-tone palette is readable. On native Win32 (SysListView32) the story is different: even with AppsUseLightTheme=0, the list keeps its default white background, and light-tone text lands on it unreadable. Users see near-white search-result text on white background in the search tab (#274, Windows 11 dark mode). Fix: pick the palette from the list control's own background colour at draw time, not the OS appearance flag. On Linux/macOS the background follows the system theme so behaviour is unchanged; on Windows the list stays white so the (readable) light-mode palette is used regardless of the AppsUseLightTheme registry setting. When wxWidgets eventually gets full Win32 dark-mode wxListCtrl support (DWMWA_USE_IMMERSIVE_DARK_MODE etc.) the helper self-corrects: background turns dark, luminance test flips, dark-mode palette kicks in. Helper lives in MuleListCtrl.h next to the shared list-ctrl base; sites in SearchListCtrl.cpp + GenericClientListCtrl.cpp are the three call sites #179 introduced. * clang-format: adjust pointer style in IsListBackgroundDark decl
Cflsft
pushed a commit
to Cflsft/amule
that referenced
this pull request
Jul 6, 2026
…mule-org#274) (amule-org#276) * fix(ui): key list-ctrl palette off actual background, not IsDark() (amule-org#274) PR amule-org#179 keyed the theme-aware palette off wxSystemSettings::GetAppearance().IsDark(). On macOS + wxGTK that matches what the native wxListCtrl actually paints — dark mode propagates to the list background — so the light-tone palette is readable. On native Win32 (SysListView32) the story is different: even with AppsUseLightTheme=0, the list keeps its default white background, and light-tone text lands on it unreadable. Users see near-white search-result text on white background in the search tab (amule-org#274, Windows 11 dark mode). Fix: pick the palette from the list control's own background colour at draw time, not the OS appearance flag. On Linux/macOS the background follows the system theme so behaviour is unchanged; on Windows the list stays white so the (readable) light-mode palette is used regardless of the AppsUseLightTheme registry setting. When wxWidgets eventually gets full Win32 dark-mode wxListCtrl support (DWMWA_USE_IMMERSIVE_DARK_MODE etc.) the helper self-corrects: background turns dark, luminance test flips, dark-mode palette kicks in. Helper lives in MuleListCtrl.h next to the shared list-ctrl base; sites in SearchListCtrl.cpp + GenericClientListCtrl.cpp are the three call sites amule-org#179 introduced. * clang-format: adjust pointer style in IsListBackgroundDark decl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #177.
PR #128's
*wxBLUEsweep coveredmuuli_wdr.cpp's dialog stat labels but didn't touch the custom DC drawing inside the list controls. Two classes of bug remained:green = 255,red = 255, ...) on a base initialised fromwxSYS_COLOUR_WINDOWTEXT. On light themes the base is black so the tints produce green / red / magenta. On dark themes the base is white-ish, so setting a channel that's already 255 is a no-op and every state collapses to the same colour — the semantic cue disappears entirely.Sites fixed
GenericClientListCtrl.cpp:1004+:1008(A4AF badge text + border)*wxBLACK,*wxBLACK_PENwxSYS_COLOUR_WINDOWTEXTGenericClientListCtrl.cpp:1042(queue rank ↓)*wxBLUE(120,170,255)dark /(0,80,200)lightGenericClientListCtrl.cpp:1045(queue rank ↑)*wxRED(255,100,100)dark /(220,0,0)lightGenericClientListCtrl.cpp:1130(filename mismatch)*wxRED(255,100,100)dark /(220,0,0)lightSearchListCtrl.cpp:362-389(state palette)WINDOWTEXTbaseIsDark()Primitive
Called per-paint (not cached at startup), so a runtime theme toggle takes effect on the next list refresh. Available since wxWidgets 3.1.3 — safely in our 3.2 minimum.
Sites intentionally not touched
CaptchaGenerator.cpp:53— drawing onto a*wxWHITE_BRUSHbitmap; theme is irrelevant.DownloadListCtrl.cpp:1035/:1037— contrast keyed off the progress bar's own hardcoded fill, not the system background.Test plan