Fix light mode in the PDF viewer + native title bar#67
Merged
Conversation
The --viewer-* chrome tokens were hardcoded dark, so the viewer's top toolbar, left page rail, and right tool sidebar stayed dark even when the app was set to light mode. Map them onto the shared --bg/--line/--fg shell tokens: dark mode resolves to the same hex values as before, while light mode now gets a matching light viewer.
The window uses native decorations, so the OS title bar followed only the system theme and clashed with an explicit in-app light/dark choice. Apply the resolved theme to the native window via setTheme (null for system), and grant the core:window:allow-set-theme capability it needs.
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
Light mode didn't reach the viewer. The top toolbar, left page rail, and right tool sidebar stayed dark in light mode, and the native window title bar followed only the OS theme.
Cause
--viewer-*chrome tokens instyles.csswere hardcoded dark (/* Viewer chrome — always dark */) and never overridden in the light/system theme blocks. All viewer chrome consumes these tokens.Fix
--viewer-*onto the shared--bg/--line/--fgshell tokens. In dark mode these resolve to the exact same hex values as before (verified 1:1), so dark mode is unchanged; light mode now gets a matching light viewer.setTheme(nullfor system), and grantcore:window:allow-set-theme.Notes
--v-*-text) is still tuned for dark backgrounds — out of scope here, separate follow-up.Verification
tsc --noEmitclean,eslintclean.