feat(projects): add generate logo script
This commit is contained in:
parent
9110d87580
commit
25daa23606
@ -1,5 +1,5 @@
|
|||||||
<div align="center">
|
<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>
|
<h1>Soybean Admin</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
"lint": "eslint . --fix",
|
"lint": "eslint . --fix",
|
||||||
"commit": "soybean git-commit",
|
"commit": "soybean git-commit",
|
||||||
"esno": "esno",
|
"esno": "esno",
|
||||||
|
"logo": "esno ./scripts/logo.ts",
|
||||||
"cleanup": "esno ./scripts/cleanup.ts",
|
"cleanup": "esno ./scripts/cleanup.ts",
|
||||||
"compress": "esno ./scripts/compress.ts",
|
"compress": "esno ./scripts/compress.ts",
|
||||||
"git-hooks": "esno ./scripts/git-hooks.ts",
|
"git-hooks": "esno ./scripts/git-hooks.ts",
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 17 KiB |
BIN
public/logo.png
BIN
public/logo.png
Binary file not shown.
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 31 KiB |
@ -1,16 +1,17 @@
|
|||||||
import { readFile } from 'fs/promises';
|
import { readFile } from 'fs/promises';
|
||||||
import nodeHtmlToImage from 'node-html-to-image';
|
import nodeHtmlToImage from 'node-html-to-image';
|
||||||
|
import themeSettings from '../src/settings/theme.json';
|
||||||
|
|
||||||
async function generatePngLogoFromSvg(svgPath: string, color: string) {
|
async function generatePngLogoFromSvg(svgPath: string, color: string) {
|
||||||
const svgStr = await readFile(svgPath, 'utf-8');
|
const svgStr = await readFile(svgPath, 'utf-8');
|
||||||
|
|
||||||
const svgStrWithColor = svgStr.replace(/currentColor/g, color);
|
const svgStrWithColor = svgStr.replace(/currentColor/g, color);
|
||||||
|
|
||||||
nodeHtmlToImage({
|
await nodeHtmlToImage({
|
||||||
output: './public/logo1.png',
|
output: './public/logo.png',
|
||||||
html: svgStrWithColor,
|
html: svgStrWithColor,
|
||||||
transparent: true
|
transparent: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
generatePngLogoFromSvg('./src/assets/svg-icon/logo.svg', '#1890ff');
|
generatePngLogoFromSvg('./src/assets/svg-icon/logo.svg', themeSettings.themeColor);
|
||||||
|
Loading…
Reference in New Issue
Block a user