Repository navigation
fix(desktop): draw the Windows caption buttons in the contrast theme's text colour - #65324
Conversation
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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:
With Color scheme on System the app's mode already follows the contrast theme, so both builds draw the same buttons:
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
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
titleBarOverlaykeep the app theme'swhiteorblack. 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.shouldUseHighContrastColorsis true, the overlay'ssymbolColoris now the theme's window text colour (systemPreferences.getColor("window-text")), the colour the page's text uses underforced-colors. Every window updates its overlay onnativeTheme'supdatedevent, 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 notitleBarOverlay.How did you verify your code works?
bun run typecheck:tscinpackages/desktop,bun run lint:changed origin/devclean,bun test src/main/windows(96 pass).shouldUseHighContrastColorsisfalseandgetColor("window-text")is#000000FF. That is the 8-digit formtitleBarOverlayalready accepts forcolor.Checklist