Browse Source

fix: 解决界面设置主题色不统一的问题 (#5449)

pull/5458/head
ssongliu 5 months ago committed by GitHub
parent
commit
584234c4f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. BIN
      frontend/src/assets/images/favicon-gold.png
  2. 9
      frontend/src/assets/images/favicon.svg
  3. 7
      frontend/src/utils/xpack.ts

BIN
frontend/src/assets/images/favicon-gold.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

9
frontend/src/assets/images/favicon.svg

@ -0,0 +1,9 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path d="M11.1451 18.8875L5.66228 15.7224V8.40336L3.5376 7.1759V16.9488L9.02038 20.114L11.1451 18.8875Z" />
<path d="M18.3397 15.7224L12.0005 19.3819L9.87683 20.6083L12.0005 21.8348L20.4644 16.9488L18.3397 15.7224Z" />
<path d="M12.0015 4.74388L14.1252 3.5174L12.0005 2.28995L3.5376 7.17591L5.66228 8.40337L12.0005 4.74388H12.0015Z" />
<path d="M14.9816 4.01077L12.8569 5.23723L18.3397 8.40336V15.7224L20.4634 16.9488V7.1759L14.9816 4.01077Z" />
<path d="M11.9995 1.02569L21.5576 6.54428V17.5795L11.9995 23.0971L2.44343 17.5795V6.54428L11.9995 1.02569ZM11.9995 0.72728L2.18182 6.39707V17.7366L11.9995 23.4064L21.8182 17.7366V6.39707L11.9995 0.72728Z" />
<path d="M12.3079 6.78001L12.9564 7.16695V17.105L12.3079 17.48V6.78001Z" />
<path d="M12.3078 6.78001L9.10889 8.6222V9.86954H10.2359V16.2854L12.3059 17.481L12.3078 6.78001Z" />
</svg>

After

Width:  |  Height:  |  Size: 942 B

7
frontend/src/utils/xpack.ts

@ -18,7 +18,12 @@ export function initFavicon() {
const link = (document.querySelector("link[rel*='icon']") || document.createElement('link')) as HTMLLinkElement;
link.type = 'image/x-icon';
link.rel = 'shortcut icon';
if (globalStore.isDarkGoldTheme) {
let goldLink = new URL(`../assets/images/favicon-gold.png`, import.meta.url).href;
link.href = favicon ? '/api/v1/images/favicon' : goldLink;
} else {
link.href = favicon ? '/api/v1/images/favicon' : '/public/favicon.png';
}
document.getElementsByTagName('head')[0].appendChild(link);
}
@ -29,9 +34,11 @@ export async function getXpackSetting() {
searchXSetting = xpackModules['../xpack/api/modules/setting.ts']['searchXSetting'] || {};
const res = await searchXSetting();
if (!res) {
initFavicon();
resetXSetting();
return;
}
initFavicon();
return res;
}
}

Loading…
Cancel
Save