Repository navigation
fix(window): match title-bar control symbols to the app theme (#26) - #48
Merged
Merged
Conversation
The OS draws minimize / maximize / close on the transparent title-bar overlay using `symbolColor`. mainWindow, quizWindow and mindMapWindow hardcoded it to `white`, so in light mode the symbols were white on the `#fafafa` title bar and effectively invisible (issue #26). Derive the symbol colour from the app theme in one helper and reapply it when the theme changes, so the controls stay legible in both modes. This also replaces ankiWindow's `nativeTheme.shouldUseDarkColors || theme === 'dark'` check: the renderer always follows the app setting, so an OS-dark machine with the app set to light got white symbols on the light bar. Fixes #26
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
Fixes #26.
With the light theme enabled, the window controls in the top-right corner
(minimize / maximize / close) were almost invisible.
Root cause
The windows use
titleBarStyle: 'hidden'plus a transparenttitleBarOverlay,so the OS draws the control symbols on top of the renderer.
mainWindow.ts,quizWindow.tsandmindMapWindow.tshardcodedsymbolColor: 'white', whichonly reads on the dark title bar. The light title bar is
#fafafa, so whitesymbols disappeared.
ankiWindow.tswas already theme-aware, but usednativeTheme.shouldUseDarkColors || theme === 'dark'; the renderer alwaysfollows the app setting, so an OS-dark machine with the app set to light still
got white symbols on the light bar.
Fix
src/main/windows/titleBarOverlay.tswithtitleBarSymbolColor,titleBarOverlayOptionsandapplyTitleBarTheme.symbol colour in the existing settings-change listeners, so it follows a live
theme switch.
nativeThemespecial case inankiWindow.ts.Verification
npm run typecheck(node / web / test) — passnpm run lint— passnpm run check:design— passnpm test— 22 pass (addstest/titleBarOverlay.test.tscovering both themes)npm run build— passNot verified: the actual OS-drawn title bar was not screenshotted on a
Windows/Linux desktop in this environment; the change only sets
symbolColor, which the test pins.