Enhance toolbar search focus and improve UI consistency#13
Merged
Conversation
Delete prettysumatra/example.html and add focusToolbarSearch helper to prettysumatra/webui/toolbar.html. The new function focuses and selects the search input with try/catch safety and returns a boolean; window.hybridToolbarFocusSearch calls it and retries via setTimeout as a fallback to ensure reliable focus in hybrid/native environments.
Send a structured theme payload from C++ to the web UI and apply it client-side. Added HomePageThemeJs() in BridgeDispatcher to build a JS payload with canvas/panel/panel2/stroke/text/muted/btn/accent and appDark, and evaluate it on home page ready and on theme toggles. Home page HTML now defines new CSS primitives and color-derived variables, adds applyHomePageTheme(themePayload) to apply dynamic colors (with legacy applyTheme kept for boolean dark mode), and immediately applies any pre-injected payload. Toolbar mapping updated (hybridToolbarApplyTheme) to set appropriate CSS vars. Also changed PrettyBorderColor() to use AccentColor(..., 40) and removed the old dark-detection helper. These changes allow precise, per-color theming of the home and toolbar UIs from the native side.
This restores SumatraPDF in the 'Open with' context menu for .pdf (and other supported formats) in case another app (e.g. Microsoft Edge) has removed the entry after taking over the default handler.
Mejoras de interfaz: se refactoriza y armoniza la barra de herramientas para mejorar usabilidad y accesibilidad.
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.
This pull request focuses on improving the theming system and visual consistency of the PrettySumatra web UI, especially for the homepage and toolbar. It introduces a more flexible, dynamic color system that allows for runtime theme injection (e.g., from native C++), enhances brand color handling, and refines several UI elements for a more polished appearance. It also removes an obsolete example HTML file.
Theming and Color System Improvements:
home.htmlto use new base variables (--canvas,--panel, etc.) and derived colors, supporting dynamic theme injection from C++ and improving maintainability. Brand colors remain stable, while most UI colors are now derived from theme payloads. ([prettysumatra/webui/home.htmlL75-R107])applyHomePageTheme,hexToRgb,rgbaFromHex) inhome.htmlto support dynamic application of theme payloads, including color parsing and CSS variable updates at runtime. ([prettysumatra/webui/home.htmlR259-R355])UI and Visual Tweaks:
Toolbar and Miscellaneous Adjustments:
toolbar.htmlfor better compactness, color consistency, and alignment (e.g., button gaps, height, and theme switch sizing). [1]], [2]], [3]], [4]])Cleanup:
prettysumatra/example.htmlfile, which is no longer needed. ([prettysumatra/example.htmlL1-L151])These changes collectively modernize the theming infrastructure, improve runtime flexibility, and enhance the overall visual polish of the PrettySumatra web UI.