Bibata-Original bitmaps

This commit is contained in:
ful1e5 2021-02-22 18:01:51 +05:30
parent e86dec5163
commit 89eba25a9d
4 changed files with 79 additions and 8 deletions

View file

@ -67,7 +67,6 @@ class BitmapsGenerator {
const out = path.resolve(this.bitmapsDir, `${key}.png`);
console.log("Saving", key, "...");
await svg.screenshot({ omitBackground: true, path: out });
await page.close();
}
@ -149,7 +148,6 @@ class BitmapsGenerator {
const number = frameNumber(index, options.framePadding);
const frame = `${key}-${number}.png`;
console.log("Saving", frame, "...");
this.saveFrameImage(frame, img);
prevImg = img;

View file

@ -8,7 +8,7 @@ const svgDir = path.resolve(root, "svg", "modern");
const main = async () => {
for (const { themeName, color } of config) {
console.log("Preparing bitmaps of", themeName, "...");
console.log("=>", themeName);
const bitmapsDir = path.resolve(root, "bitmaps", themeName);
const svg = new SVGHandler.SvgDirectoryParser(svgDir);
@ -17,11 +17,15 @@ const main = async () => {
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);
}

View file

@ -0,0 +1,40 @@
import { Colors } from "bibata-core/src/types";
interface Config {
themeName: string;
color: Colors;
}
const black = "#000000";
const white = "#FFFFFF";
const amber = "#FF8300";
const richBlack = "#001524";
const config: Config[] = [
{
themeName: "Bibata-Original-Amber",
color: {
base: amber,
outline: white,
watch: {
background: richBlack,
},
},
},
{
themeName: "Bibata-Original-Classic",
color: {
base: black,
outline: white,
},
},
{
themeName: "Bibata-Original-Ice",
color: {
base: white,
outline: black,
},
},
];
export { config };

View file

@ -1,8 +1,37 @@
import { main } from "bibata-core";
import path from "path";
const hmm = async () => {
main();
console.log("Bibata Original");
import { BitmapsGenerator, SVGHandler } from "bibata-core";
import { config } from "./config";
const root = path.resolve(__dirname, "../../../../");
const svgDir = path.resolve(root, "svg", "modern");
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();
}
};
hmm();
main();