feat(projects): add generate logo script

This commit is contained in:
Soybean 2023-01-03 23:45:00 +08:00
parent 9110d87580
commit 25daa23606
5 changed files with 6 additions and 4 deletions

View File

@ -1,5 +1,5 @@
<div align="center">
<img src="https://i.loli.net/2021/11/24/x5lLfuSnEawBAgi.png"/>
<img src="./public/logo.png" style="width: 240px;"/>
<h1>Soybean Admin</h1>
</div>

View File

@ -47,6 +47,7 @@
"lint": "eslint . --fix",
"commit": "soybean git-commit",
"esno": "esno",
"logo": "esno ./scripts/logo.ts",
"cleanup": "esno ./scripts/cleanup.ts",
"compress": "esno ./scripts/compress.ts",
"git-hooks": "esno ./scripts/git-hooks.ts",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -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);