Skip to content

fix(desktop): draw the Windows caption buttons in the contrast theme's text colour - #65324

Merged
Hona merged 2 commits into
devfrom
contrast-caption
Nov 21, 2026
Merged

Hona merged 2 commits into
devfrom
contrast-caption

Conversation

@Hona

@Hona Hona commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Screenshots

The end of the app window's title bar with its caption buttons, cropped from the window's own frame, with a Windows contrast theme on (switched for the capture and switched back).

The fix is for the app's Color scheme set against the contrast theme's kind:

App Color scheme, contrast theme Before After
Light, Night sky Before: black buttons on a black title bar After: white buttons on a black title bar
Light, Aquatic Before: black buttons on a dark title bar After: white buttons on a dark title bar
Dark, Desert Before: near-white buttons on a cream title bar After: black buttons on a cream title bar

With Color scheme on System the app's mode already follows the contrast theme, so both builds draw the same buttons:

App Color scheme, contrast theme Before After
System, none Before: no contrast theme After: no contrast theme
System, Night sky Before: Night sky After: Night sky
System, Desert Before: Desert After: Desert

Issue for this PR

No linked issue. Ported from the native Rune desktop build, which reads the Windows contrast theme's colours for its window chrome (anomalyco/rune, crates/rune/src/platform/preferences.rs).

Type of change

  • Bug fix

What does this PR do?

With a Windows contrast theme on (Settings › Accessibility › Contrast themes), Chromium repaints the page in the theme's system colours, but the native caption buttons drawn by titleBarOverlay keep the app theme's white or black. Under Aquatic or Night Sky with a light app theme, minimize, maximize and close are black on a black title bar.

On Windows, when nativeTheme.shouldUseHighContrastColors is true, the overlay's symbolColor is now the theme's window text colour (systemPreferences.getColor("window-text")), the colour the page's text uses under forced-colors. Every window updates its overlay on nativeTheme's updated event, so switching the contrast theme on or off while the app runs applies at once.

macOS and Linux are unchanged: both the colour choice and the listener run only when process.platform === "win32", and macOS has no titleBarOverlay.

How did you verify your code works?

  • bun run typecheck:tsc in packages/desktop, bun run lint:changed origin/dev clean, bun test src/main/windows (96 pass).
  • Read the same values in an Electron 44.9.1 main process that creates no window: shouldUseHighContrastColors is false and getColor("window-text") is #000000FF. That is the 8-digit form titleBarOverlay already accepts for color.
  • Checked under each Windows contrast theme with the app's Color scheme on System, and with Light under Night sky and Aquatic and Dark under Desert, before and after (screenshots above).

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks sound, but I couldn't verify it. It only affects the Windows caption buttons under a contrast theme, and I had no Windows machine to test on. I read it against the other title bar paths. The early window picks up the colour through platformFrame/titlebarOverlay, and other windows through updateTitlebar. The updated listener only redraws the overlays and never sets themeSource, so it can't loop. tsc -b is clean and bun test src/main/windows passes (96 of 96).

Public API: unchanged.

No blocking concerns. Since the caption buttons weren't tested under a real contrast theme, a before/after screenshot under Aquatic or Night Sky would be good to have before merging.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new commit only merges dev, so the change itself is the same and still looks sound. The merge applied cleanly, tsc -b is clean and bun test src/main/windows passes. The public API is unchanged. I still couldn't run it without a Windows contrast theme, so a before/after screenshot under Aquatic or Night Sky would still be good to have.

@Hona
Hona merged commit ba5bbef into dev Nov 21, 2026
14 checks passed
@Hona
Hona deleted the contrast-caption branch November 21, 2026 10:53
@amrkmn amrkmn mentioned this pull request Nov 23, 2026
1 task
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.

1 participant