fix: preserve favicon outline during tinting

This commit is contained in:
2026-07-29 15:24:53 +08:00
parent fbd1034985
commit b4e9b3ecfa
+1 -1
View File
@@ -35,7 +35,7 @@ export function resetXSetting() {
async function getColoredFavicon(url: string, color: string) {
const res = await fetch(url);
let svgText = await res.text();
svgText = svgText.replace(/fill=(["'])(.*?)\1/g, `fill="${color}"`);
svgText = svgText.replace(/fill=(["'])currentColor\1/g, `fill="${color}"`);
svgText = svgText.replaceAll('currentColor', color);
return `data:image/svg+xml,${encodeURIComponent(svgText)}`;
}