Remove individual cursor customization

This commit is contained in:
ful1e5 2020-08-17 16:28:29 +05:30
parent afc78a2873
commit efe1992d7c
3 changed files with 7 additions and 31 deletions

View file

@ -2,7 +2,7 @@ import path from "path";
import { ColorSchema } from "./types"; import { ColorSchema } from "./types";
// --------------------------------------- Paths // --------------------------------------- Paths 🔗
const rawSvgsDir = path.resolve("src", "svg", "raw"); const rawSvgsDir = path.resolve("src", "svg", "raw");
const schemesPath = path.resolve("src", "svg"); const schemesPath = path.resolve("src", "svg");
@ -23,15 +23,6 @@ const watchColors = {
color4: blue // top-left shape color color4: blue // top-left shape color
}; };
// --------------------------------------- Custimized Corner Colors (Bibata Style) 🚀
const customize = {
"top_right_corner.svg": { base: red },
"bottom_right_corner.svg": { base: yellow },
"bottom_left_corner.svg": { base: green },
"top_left_corner.svg": { base: blue }
};
// --------------------------------------- Schemes🌈 // --------------------------------------- Schemes🌈
const colorSchemes: ColorSchema = { const colorSchemes: ColorSchema = {
Ice: { Ice: {
@ -40,8 +31,7 @@ const colorSchemes: ColorSchema = {
watch: { watch: {
background: white, background: white,
...watchColors ...watchColors
}, }
customize
}, },
Classic: { Classic: {
base: black, base: black,
@ -49,8 +39,7 @@ const colorSchemes: ColorSchema = {
watch: { watch: {
background: black, background: black,
...watchColors ...watchColors
}, }
customize
} }
}; };

View file

@ -5,6 +5,8 @@ import { staticCursors, animatedCursors, animatedClip } from "../cursors.json";
import { schemesPath } from "../color"; import { schemesPath } from "../color";
import { ColorSchema, Configs } from "../types"; import { ColorSchema, Configs } from "../types";
// --------------------------------------- Generate Configs 🛠
const generateConfigs = ( const generateConfigs = (
colorSchemes: ColorSchema, colorSchemes: ColorSchema,
dirPrefix: string, dirPrefix: string,
@ -18,7 +20,7 @@ const generateConfigs = (
const configs: Configs = {}; const configs: Configs = {};
for (let [schema] of Object.entries(colorSchemes)) { for (let [schema] of Object.entries(colorSchemes)) {
const { base, outline, watch, customize } = colorSchemes[schema]; const { base, outline, watch } = colorSchemes[schema];
const schemaName = `${dirPrefix}-${schema}`; const schemaName = `${dirPrefix}-${schema}`;
const schemaSvgsPath = path.resolve(schemesPath, schemaName); const schemaSvgsPath = path.resolve(schemesPath, schemaName);
@ -30,16 +32,7 @@ const generateConfigs = (
.readFileSync(path.resolve(rawSvgsDir, cursor), "utf-8") .readFileSync(path.resolve(rawSvgsDir, cursor), "utf-8")
.toString(); .toString();
// try => replace `customize` colors
// onError => replace `schema` main colors
try {
let { base: b, outline: o } = customize![cursor];
if (!b) b = base;
if (!o) o = outline;
content = content.replace("#00FF00", b).replace("#0000FF", o);
} catch (error) {
content = content.replace("#00FF00", base).replace("#0000FF", outline); content = content.replace("#00FF00", base).replace("#0000FF", outline);
}
// Save Schema // Save Schema
const cursorPath = path.resolve(schemaSvgsPath, cursor); const cursorPath = path.resolve(schemaSvgsPath, cursor);

View file

@ -9,12 +9,6 @@ interface ColorSchema {
color3: string; color3: string;
color4: string; color4: string;
}; };
customize?: {
[name: string]: {
outline?: string;
base?: string;
};
};
}; };
} }