mirror of
https://github.com/ful1e5/Bibata_Cursor.git
synced 2025-05-27 13:34:20 -04:00
🖼️ Render static pngs
This commit is contained in:
parent
99dde92a8a
commit
05a7d723f6
3 changed files with 99 additions and 40 deletions
|
@ -1,19 +1,38 @@
|
|||
import path from "path";
|
||||
import fs from "fs";
|
||||
|
||||
import { BitmapsGenerator, SVGHandler } from "bibata-core";
|
||||
import { Colors } from "bibata-core/src/types";
|
||||
|
||||
const root = path.resolve(__dirname, "../../../../");
|
||||
const svgDir = path.resolve(root, "svg", "modern");
|
||||
|
||||
const themeName = "Bibata-Modern";
|
||||
const bitmapsDir = path.resolve(root, "bitmaps", themeName);
|
||||
|
||||
const color: Colors = {
|
||||
base: "#000000",
|
||||
outline: "#FFFFFF",
|
||||
watch: {
|
||||
background: "#FFFFFF",
|
||||
},
|
||||
};
|
||||
|
||||
const main = async () => {
|
||||
const SVG = new SVGHandler.SvgDirectoryParser(svgDir);
|
||||
|
||||
SVG.getStatic().forEach((svg) => {
|
||||
console.log(svg);
|
||||
});
|
||||
const png = new BitmapsGenerator(bitmapsDir);
|
||||
const browser = await png.getBrowser();
|
||||
|
||||
SVG.getAnimated().forEach((svg) => {
|
||||
console.log(svg);
|
||||
SVG.getStatic().forEach(async (svg) => {
|
||||
const key = `${path.basename(svg, ".svg")}.png`;
|
||||
console.log("Saving", key, "...");
|
||||
const out = path.resolve(bitmapsDir, key);
|
||||
|
||||
let content = fs.readFileSync(svg, "utf-8");
|
||||
content = SVGHandler.colorSvg(content, color);
|
||||
|
||||
await png.generate(browser, content, out);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue