mirror of
https://github.com/Melorise/nPanel.git
synced 2026-11-07 14:49:35 +00:00
fix: preserve favicon outline during tinting
This commit is contained in:
@@ -35,7 +35,7 @@ export function resetXSetting() {
|
|||||||
async function getColoredFavicon(url: string, color: string) {
|
async function getColoredFavicon(url: string, color: string) {
|
||||||
const res = await fetch(url);
|
const res = await fetch(url);
|
||||||
let svgText = await res.text();
|
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);
|
svgText = svgText.replaceAll('currentColor', color);
|
||||||
return `data:image/svg+xml,${encodeURIComponent(svgText)}`;
|
return `data:image/svg+xml,${encodeURIComponent(svgText)}`;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user