Skip to content

Enhance toolbar search focus and improve UI consistency#13

Merged
JaviLendi merged 6 commits into
masterfrom
UI-Improvements
May 26, 2026
Merged

Enhance toolbar search focus and improve UI consistency#13
JaviLendi merged 6 commits into
masterfrom
UI-Improvements

Conversation

@JaviLendi

Copy link
Copy Markdown
Owner

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:

  • Refactored CSS variables in home.html to 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])
  • Added JavaScript functions (applyHomePageTheme, hexToRgb, rgbaFromHex) in home.html to support dynamic application of theme payloads, including color parsing and CSS variable updates at runtime. ([prettysumatra/webui/home.htmlR259-R355])
  • Updated dark mode handling in both CSS and JS to use the new variable system and ensure brand color consistency across light and dark themes. ([prettysumatra/webui/home.htmlL107-R123])

UI and Visual Tweaks:

  • Improved visual consistency of buttons, cards, and icons by switching to use brand gradients and the new color system, and refined box shadows and hover states for a more modern look. [1]], [2]])
  • Added logic and CSS to hide toolbar buttons on the homepage, both via a CSS class and by signaling to the host application and other frames, ensuring a clean UI when appropriate. [1]], [2]])

Toolbar and Miscellaneous Adjustments:

  • Tweaked toolbar styles in toolbar.html for better compactness, color consistency, and alignment (e.g., button gaps, height, and theme switch sizing). [1]], [2]], [3]], [4]])

Cleanup:

These changes collectively modernize the theming infrastructure, improve runtime flexibility, and enhance the overall visual polish of the PrettySumatra web UI.

JaviLendi and others added 6 commits May 21, 2026 13:33
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.
@JaviLendi
JaviLendi merged commit 347fa7b into master May 26, 2026
5 checks passed
@JaviLendi
JaviLendi deleted the UI-Improvements branch May 26, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants