mirror of
https://github.com/ful1e5/Bibata_Cursor.git
synced 2025-06-03 00:19:52 -04:00
🌈 Cursors Schema
This commit is contained in:
parent
0a00833f72
commit
f60a71c02f
1 changed files with 33 additions and 7 deletions
|
@ -10,10 +10,15 @@ const generateConfigs = (
|
|||
dirPrefix: string,
|
||||
rawSvgsDir: string
|
||||
) => {
|
||||
if (!fs.existsSync(rawSvgsDir)) {
|
||||
console.error("🚨🚨 Raw files not Found 🚨🚨");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const configs: Configs = {};
|
||||
|
||||
for (let [schema] of Object.entries(colorSchemes)) {
|
||||
const { base, outline, watchBackground } = colorSchemes[schema];
|
||||
const { base, outline, watch, customize } = colorSchemes[schema];
|
||||
const schemaName = `${dirPrefix}-${schema}`;
|
||||
|
||||
const schemaSvgsPath = path.resolve(schemesPath, schemaName);
|
||||
|
@ -23,13 +28,19 @@ const generateConfigs = (
|
|||
staticCursors.map((cursor: string) => {
|
||||
// Read file
|
||||
const cursorPath = path.resolve(schemaSvgsPath, cursor);
|
||||
|
||||
// Replacing colorSchema
|
||||
let content = fs
|
||||
.readFileSync(path.resolve(rawSvgsDir, cursor), "utf-8")
|
||||
.toString();
|
||||
|
||||
content = content.replace("#00FF00", base).replace("#0000FF", outline);
|
||||
// trying to customize color if not available then main schema color
|
||||
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);
|
||||
}
|
||||
|
||||
// Writing new svg
|
||||
fs.writeFileSync(cursorPath, content, "utf-8");
|
||||
|
@ -39,13 +50,28 @@ const generateConfigs = (
|
|||
for (let [cursor] of Object.entries(animatedCursors)) {
|
||||
// Read file
|
||||
const cursorPath = path.resolve(schemaSvgsPath, cursor);
|
||||
|
||||
// Replacing colorSchema
|
||||
let content = fs
|
||||
.readFileSync(path.resolve(rawSvgsDir, cursor), "utf-8")
|
||||
.toString();
|
||||
|
||||
content = content.replace("#00FF00", watchBackground);
|
||||
content = content.replace("#00FF00", base).replace("#0000FF", outline);
|
||||
// trying to customize color if not available then main schema color
|
||||
try {
|
||||
if (!watch) throw new Error("");
|
||||
const {
|
||||
background: b,
|
||||
color1: c1,
|
||||
color2: c2,
|
||||
color3: c3,
|
||||
color4: c4
|
||||
} = watch;
|
||||
content = content.replace("#TODO", b); //Inter watch circle
|
||||
content = content
|
||||
.replace("#TODO", c1)
|
||||
.replace("#TODO", c2)
|
||||
.replace("#TODO", c3)
|
||||
.replace("#TODO", c4);
|
||||
} catch (error) {}
|
||||
|
||||
// Writing new svg
|
||||
fs.writeFileSync(cursorPath, content, "utf-8");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue