🔣 Regex support

This commit is contained in:
ful1e5 2020-08-20 11:59:15 +05:30
parent 0b2e1e3a22
commit ff71def4aa

View file

@ -7,6 +7,7 @@ import {
bitmapsPath, bitmapsPath,
baseKeyColor, baseKeyColor,
outlineKeyColor, outlineKeyColor,
watchKeyColor,
rawSvgsDir rawSvgsDir
} from "../color"; } from "../color";
import { ColorSchema, Configs } from "../types"; import { ColorSchema, Configs } from "../types";
@ -35,8 +36,8 @@ const generateConfigs = (colorSchemes: ColorSchema, dirPrefix: string) => {
.toString(); .toString();
content = content content = content
.replace(baseKeyColor, base) .replace(new RegExp(baseKeyColor, "g"), base)
.replace(outlineKeyColor, outline); .replace(new RegExp(outlineKeyColor), outline);
// Save Schema // Save Schema
const cursorPath = path.resolve(schemaSvgsPath, cursor); const cursorPath = path.resolve(schemaSvgsPath, cursor);
@ -54,15 +55,15 @@ const generateConfigs = (colorSchemes: ColorSchema, dirPrefix: string) => {
// 2) Watch Color // 2) Watch Color
content = content content = content
.replace(baseKeyColor, base) .replace(new RegExp(baseKeyColor, "g"), base)
.replace(outlineKeyColor, outline); .replace(new RegExp(outlineKeyColor, "g"), outline);
// try => replace `customize` colors // try => replace `customize` colors
// onError => replace `schema` main colors // onError => replace `schema` main colors
try { try {
if (!watch) throw new Error(""); if (!watch) throw new Error("");
const { background: b } = watch; const { background: b } = watch;
content = content.replace("#TODO", b); // Watch Background content = content.replace(new RegExp(watchKeyColor, "g"), b); // Watch Background
} catch (error) {} } catch (error) {}
// Save Schema // Save Schema