mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat(projects): add script about generating png logo from [添加根据svg生成png图标的命令]
This commit is contained in:
16
scripts/logo.ts
Normal file
16
scripts/logo.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { readFile } from 'fs/promises';
|
||||
import nodeHtmlToImage from 'node-html-to-image';
|
||||
|
||||
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',
|
||||
html: svgStrWithColor,
|
||||
transparent: true
|
||||
});
|
||||
}
|
||||
|
||||
generatePngLogoFromSvg('./src/assets/svg-icon/logo.svg', '#1890ff');
|
Reference in New Issue
Block a user