logo.ts 428 B

123456789101112
  1. import { readFile, writeFile } from 'fs/promises';
  2. import themeSettings from '../src/settings/theme.json';
  3. async function updateFavicon(svgPath: string, color: string) {
  4. const svgStr = await readFile(svgPath, 'utf-8');
  5. const svgStrWithColor = svgStr.replace(/currentColor/g, color);
  6. await writeFile('./public/favicon.svg', svgStrWithColor);
  7. }
  8. updateFavicon('./src/assets/svg-icon/logo.svg', themeSettings.themeColor);