Skip to content

Commit 9be96d4

Browse files
fix(ui): update favicon dynamically based on app theme
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.
1 parent ddff8b9 commit 9be96d4

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

‎apps/dokploy/components/proprietary/whitelabeling/whitelabeling-provider.tsx‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
11
"use client";
22

33
import Head from "next/head";
4+
import { useTheme } from "next-themes";
45
import { api } from "@/utils/api";
56

67
export function WhitelabelingProvider() {
8+
const { resolvedTheme } = useTheme();
79
const { data: config } = api.whitelabeling.getPublic.useQuery(undefined, {
810
staleTime: 5 * 60 * 1000,
911
refetchOnWindowFocus: false,
1012
});
1113

14+
const faviconHref = config?.faviconUrl
15+
?? (resolvedTheme === "dark" ? "/icon-dark.svg"
16+
: resolvedTheme === "light" ? "/icon-light.svg"
17+
: "/icon.svg");
18+
1219
if (!config) return null;
1320

1421
return (
1522
<>
1623
<Head>
1724
{config.metaTitle && <title>{config.metaTitle}</title>}
18-
{config.faviconUrl && <link rel="icon" href={config.faviconUrl} />}
25+
<link rel="icon" href={faviconHref} key="app-favicon" />
1926
</Head>
2027

2128
{config.customCss && (

‎apps/dokploy/public/icon-dark.svg‎

Lines changed: 5 additions & 0 deletions
Loading

‎apps/dokploy/public/icon-light.svg‎

Lines changed: 5 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)