Skip to content

fix(ui): update favicon dynamically based on app theme#4225

Open
GuillaumeLecomte1 wants to merge 2 commits intoDokploy:canaryfrom
GuillaumeLecomte1:fix/favicon-theme-toggle
Open

fix(ui): update favicon dynamically based on app theme#4225
GuillaumeLecomte1 wants to merge 2 commits intoDokploy:canaryfrom
GuillaumeLecomte1:fix/favicon-theme-toggle

Conversation

@GuillaumeLecomte1
Copy link
Copy Markdown

@GuillaumeLecomte1 GuillaumeLecomte1 commented Apr 14, 2026

Summary

The favicon did not switch between light and dark variants when toggling the app theme because it relied on OS prefers-color-scheme media query instead of the app-level theme state.

Changes

New files:

  • icon-light.svg - favicon with fill=black
  • icon-dark.svg - favicon with fill=white

Modified:

  • WhitelabelingProvider.tsx - Added useTheme from next-themes and logic to select icon based on resolvedTheme. Custom faviconUrl still takes precedence.

Closes #4100

Greptile Summary

This PR adds two new SVG assets (icon-dark.svg with white fill, icon-light.svg with black fill) and updates WhitelabelingProvider to select the favicon based on resolvedTheme from next-themes, so the app-level theme toggle is respected instead of the OS media query.

  • The faviconHref is computed before if (!config) return null, but the component still returns null while config loads, meaning the theme-aware favicon isn't rendered during the initial API call — the non-themed /icon.svg from _document.tsx shows until config resolves. The early return should be removed and optional chaining used throughout JSX so the favicon link renders immediately.

Confidence Score: 4/5

  • The PR partially works — theme changes after load are handled correctly — but the fix doesn't apply during initial page load due to the early return guard.
  • One P1 issue: the if (!config) return null guard prevents the theme-aware favicon from rendering before config resolves, meaning the feature only works after the first API call completes. This is a real behavioral gap in the fix.
  • apps/dokploy/components/proprietary/whitelabeling/whitelabeling-provider.tsx

Reviews (1): Last reviewed commit: "fix(ui): update favicon dynamically base..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!

Add icon-light.svg and icon-dark.svg with fixed fills (black/white)
instead of relying on CSS prefers-color-scheme media query.

Update WhitelabelingProvider to use useTheme() and switch favicon
based on resolvedTheme (dark/light/unknown).

When custom faviconUrl is set, it takes precedence.

Closes Dokploy#4100.
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Apr 14, 2026
Comment thread apps/dokploy/components/proprietary/whitelabeling/whitelabeling-provider.tsx Outdated
The previous implementation returned null when config was not yet loaded,
preventing the theme-aware favicon from rendering during initial page load.

Now uses optional chaining (config?.metaTitle, config?.customCss) throughout
so the <link rel="icon"> always renders with the correct theme-aware favicon
regardless of config loading state.

Fixes P1 issue from code review.
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Favicon does not update on theme toggle without page reload

1 participant