Skip to content

ui: theme-aware list-control colours (drop hardcoded *wxBLACK/BLUE/RED) - #179

Merged
got3nks merged 1 commit into
amule-org:masterfrom
got3nks:fix/dark-theme-list-colors
Jun 17, 2026
Merged

ui: theme-aware list-control colours (drop hardcoded *wxBLACK/BLUE/RED)#179
got3nks merged 1 commit into
amule-org:masterfrom
got3nks:fix/dark-theme-list-colors

Conversation

@got3nks

@got3nks got3nks commented Jun 16, 2026

Copy link
Copy Markdown

Summary

Closes #177.

PR #128's *wxBLUE sweep covered muuli_wdr.cpp's dialog stat labels but didn't touch the custom DC drawing inside the list controls. Two classes of bug remained:

  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 palette overlays per-channel tints (green = 255, red = 255, ...) on a base initialised from wxSYS_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

Site Was Now
GenericClientListCtrl.cpp:1004 + :1008 (A4AF badge text + border) *wxBLACK, *wxBLACK_PEN wxSYS_COLOUR_WINDOWTEXT
GenericClientListCtrl.cpp:1042 (queue rank ↓) *wxBLUE (120,170,255) dark / (0,80,200) light
GenericClientListCtrl.cpp:1045 (queue rank ↑) *wxRED (255,100,100) dark / (220,0,0) light
GenericClientListCtrl.cpp:1130 (filename mismatch) *wxRED (255,100,100) dark / (220,0,0) light
SearchListCtrl.cpp:362-389 (state palette) channel-tweak on WINDOWTEXT base explicit per-state palette branching on IsDark()

Primitive

const bool isDark = wxSystemSettings::GetAppearance().IsDark();

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_BRUSH bitmap; theme is irrelevant.
  • DownloadListCtrl.cpp:1035 / :1037 — contrast keyed off the progress bar's own hardcoded fill, not the system background.

Test plan

  • macOS arm64 dark mode + light mode: all five sites readable.
  • @Stoatwblr — would you test against your environment before this merges? The two original sites you reported plus the three adjacent ones I caught while sweeping: queue rank decrease + increase pair, the filename-mismatch highlight, and the search-result list state colours (which had the additional bug of being completely indistinguishable on dark themes). Please paste a quick visual or log confirmation when you've had a look.
  • CI build matrix.

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
@got3nks got3nks mentioned this pull request Jun 16, 2026
@Stoatwblr

Copy link
Copy Markdown

All five are cleared. Thanks

@got3nks
got3nks merged commit 6451f6b into amule-org:master Jun 17, 2026
10 checks passed
@got3nks
got3nks deleted the fix/dark-theme-list-colors branch June 17, 2026 08:33
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
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.

#128 fine tuning

2 participants