2023-02-09 23:25:00 +08:00
|
|
|
import { readFile, writeFile } from 'fs/promises';
|
2023-01-03 23:45:00 +08:00
|
|
|
import themeSettings from '../src/settings/theme.json';
|
2022-12-09 19:14:37 +08:00
|
|
|
|
2023-02-09 23:25:00 +08:00
|
|
|
async function updateFavicon(svgPath: string, color: string) {
|
2022-12-09 19:14:37 +08:00
|
|
|
const svgStr = await readFile(svgPath, 'utf-8');
|
|
|
|
|
|
|
|
const svgStrWithColor = svgStr.replace(/currentColor/g, color);
|
|
|
|
|
2023-02-09 23:25:00 +08:00
|
|
|
await writeFile('./public/favicon.svg', svgStrWithColor);
|
2022-12-09 19:14:37 +08:00
|
|
|
}
|
|
|
|
|
2023-02-09 23:25:00 +08:00
|
|
|
updateFavicon('./src/assets/svg-icon/logo.svg', themeSettings.themeColor);
|