mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat(projects): add generate logo script
This commit is contained in:
@ -1,16 +1,17 @@
|
||||
import { readFile } from 'fs/promises';
|
||||
import nodeHtmlToImage from 'node-html-to-image';
|
||||
import themeSettings from '../src/settings/theme.json';
|
||||
|
||||
async function generatePngLogoFromSvg(svgPath: string, color: string) {
|
||||
const svgStr = await readFile(svgPath, 'utf-8');
|
||||
|
||||
const svgStrWithColor = svgStr.replace(/currentColor/g, color);
|
||||
|
||||
nodeHtmlToImage({
|
||||
output: './public/logo1.png',
|
||||
await nodeHtmlToImage({
|
||||
output: './public/logo.png',
|
||||
html: svgStrWithColor,
|
||||
transparent: true
|
||||
});
|
||||
}
|
||||
|
||||
generatePngLogoFromSvg('./src/assets/svg-icon/logo.svg', '#1890ff');
|
||||
generatePngLogoFromSvg('./src/assets/svg-icon/logo.svg', themeSettings.themeColor);
|
||||
|
Reference in New Issue
Block a user