🚀 Render bitmaps

This commit is contained in:
ful1e5
2021-04-17 16:34:09 +05:30
parent c70be8bbe4
commit 146ea32760
+33 -1
View File
@@ -1,5 +1,37 @@
import path from "path";
import { BitmapsGenerator, SVGHandler } from "./core";
import { config } from "./config";
const root = path.resolve(__dirname, "../../");
const svgDir = path.resolve(root, "svg");
const main = async () => { const main = async () => {
console.log('BreezeX Cursor rendering..') for (const { themeName, color } of config) {
console.log("=>", themeName);
const bitmapsDir = path.resolve(root, "bitmaps", themeName);
const svg = new SVGHandler.SvgDirectoryParser(svgDir);
const png = new BitmapsGenerator(bitmapsDir);
const browser = await png.getBrowser();
for (let { key, content } of svg.getStatic()) {
console.log(" -> Saving", key, "...");
content = SVGHandler.colorSvg(content, color);
await png.generateStatic(browser, content, key);
}
for (let { key, content } of svg.getAnimated()) {
console.log(" -> Saving", key, "...");
content = SVGHandler.colorSvg(content, color);
await png.generateAnimated(browser, content, key);
}
await browser.close();
}
}; };
main(); main();