Repository navigation
fix(desktop): match the Windows title bar color to the app surface - #547
Merged
Merged
Conversation
The Windows frame is drawn by DWM, so a decorated window gets the system caption color -- a light gray band (wallpaper-tinted when transparency is on) sitting directly above the webview's white canvas. macOS never shows this seam because itleBarStyle: Overlay hands the top strip to the app. On Windows 11 (21H2+) pin the caption and title-text colors to the app palette (surface / ink from tailwind.config.js), and clear the dark-mode attribute so a dark system theme cannot darken the caption either. Unsupported attributes on older builds are rejected and leave the default.
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.
Problem
On Windows the desktop window's top strip renders in a different color from the rest of the window. The frame is drawn by DWM, so a decorated window gets the system caption color — a light gray band, tinted by the wallpaper when transparency is on — sitting directly above the webview's white canvas. macOS never shows this seam because
titleBarStyle: "Overlay"hands the top strip to the app.Measured on a live window before the fix (top band #F3F3F3 vs. app surface #FFFFFF):
Fix
match_windows_caption_colorruns insetup, next to the existing taskbar-icon fix:DWMWA_CAPTION_COLORto thesurfacetoken (#ffffff) andDWMWA_TEXT_COLORtoink(#172033), so the caption matches the app's own top strip.DWMWA_USE_IMMERSIVE_DARK_MODEso a dark system theme cannot darken the caption either (the app palette is light-only).Resultis ignored and the default is left in place, so this degrades to today's behavior.Verification
Verified against a live window with the same DWM call: setting
DWMWA_CAPTION_COLORto white turned the previously #F3F3F3 band to #FFFFFF, matching the webview surface.cargo fmt --check/cargo clippy --all-targets -- -D warningsunderdesktop/src-tauri— cleancargo test --lib windows_caption— passes (mock-app no-op arm; the color effect itself is only observable on a live window)Note: 25 pre-existing
git/temp-dir tests in this crate fail on this machine both before and after the change (child-process spawn denied in the shell environment); they are unrelated to this diff.