refactor: bigsur cursor bitmapper as node package

This commit is contained in:
ful1e5 2021-11-21 16:04:42 +05:30
parent c171d176ff
commit eca8cb5760
9 changed files with 99 additions and 784 deletions

View file

@ -0,0 +1,28 @@
import { Colors } from "core/src/types";
interface Config {
themeName: string;
color: Colors;
}
const black = "#000000";
const white = "#FFFFFF";
const config: Config[] = [
{
themeName: "macOSBigSur",
color: {
base: black,
outline: white,
},
},
{
themeName: "macOSBigSur-White",
color: {
base: white,
outline: black,
},
},
];
export { config };

View file

@ -0,0 +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", "bigsur");
const main = async () => {
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();