🌈 Colors config init

This commit is contained in:
ful1e5 2021-02-22 17:35:42 +05:30
parent 6c44d15642
commit d7169a34b8
2 changed files with 59 additions and 25 deletions

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-Modern-Amber",
color: {
base: amber,
outline: white,
watch: {
background: richBlack,
},
},
},
{
themeName: "Bibata-Modern-Classic",
color: {
base: black,
outline: white,
},
},
{
themeName: "Bibata-Modern-Ice",
color: {
base: white,
outline: black,
},
},
];
export { config };

View file

@ -1,39 +1,33 @@
import path from "path"; import path from "path";
import { BitmapsGenerator, SVGHandler } from "bibata-core"; import { BitmapsGenerator, SVGHandler } from "bibata-core";
import { Colors } from "bibata-core/src/types"; import { config } from "./config";
const root = path.resolve(__dirname, "../../../../"); const root = path.resolve(__dirname, "../../../../");
const svgDir = path.resolve(root, "svg", "modern"); 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 main = async () => {
const SVG = new SVGHandler.SvgDirectoryParser(svgDir); for (const { themeName, color } of config) {
console.log("Preparing bitmaps of", themeName, "...");
const bitmapsDir = path.resolve(root, "bitmaps", themeName);
const svg = new SVGHandler.SvgDirectoryParser(svgDir);
const png = new BitmapsGenerator(bitmapsDir); const png = new BitmapsGenerator(bitmapsDir);
const browser = await png.getBrowser(); const browser = await png.getBrowser();
for (let { key, content } of SVG.getStatic()) { for (let { key, content } of svg.getStatic()) {
content = SVGHandler.colorSvg(content, color); content = SVGHandler.colorSvg(content, color);
await png.generateStatic(browser, content, key); await png.generateStatic(browser, content, key);
} }
for (let { key, content } of SVG.getAnimated()) { for (let { key, content } of svg.getAnimated()) {
content = SVGHandler.colorSvg(content, color); content = SVGHandler.colorSvg(content, color);
await png.generateAnimated(browser, content, key); await png.generateAnimated(browser, content, key);
} }
await browser.close(); await browser.close();
}
}; };
main(); main();