-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreplace_colors.js
More file actions
36 lines (32 loc) · 1.14 KB
/
replace_colors.js
File metadata and controls
36 lines (32 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const fs = require('fs');
const path = require('path');
const replacers = [
// Primary Accents (Text, bg, border, hovers, strokes, fills)
{ regex: /\[\#2B5C92\]/g, replacement: '[#43B6D5]' },
{ regex: /\[\#0E2F76\]/g, replacement: '[#43B6D5]' },
// Gradients and dark blue bits
{ regex: /\[\#0C1446\]/g, replacement: '[#2A8FA8]' }, // A slightly darker cyan for gradient depth
];
function processDir(dir) {
const files = fs.readdirSync(dir);
for (const file of files) {
const fullPath = path.join(dir, file);
if (fs.statSync(fullPath).isDirectory()) {
processDir(fullPath);
} else if (fullPath.endsWith('.tsx') || fullPath.endsWith('.ts') || fullPath.endsWith('.css')) {
let content = fs.readFileSync(fullPath, 'utf8');
let changed = false;
for (const { regex, replacement } of replacers) {
if (regex.test(content)) {
content = content.replace(regex, replacement);
changed = true;
}
}
if (changed) {
fs.writeFileSync(fullPath, content, 'utf8');
console.log('Updated', fullPath);
}
}
}
}
processDir(path.join(__dirname, 'apps/web/src'));