mirror of
https://github.com/ful1e5/Bibata_Cursor.git
synced 2025-05-19 09:45:24 -04:00
🔣 Regex support
This commit is contained in:
parent
0b2e1e3a22
commit
ff71def4aa
1 changed files with 6 additions and 5 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue