-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreplace_activetheme.cjs
More file actions
23 lines (18 loc) · 973 Bytes
/
replace_activetheme.cjs
File metadata and controls
23 lines (18 loc) · 973 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const fs = require('fs');
const path = require('path');
const filePath = path.join(__dirname, 'components/AnalysisDisplay.tsx');
let content = fs.readFileSync(filePath, 'utf8');
content = content.replace(
/const \[activeTheme, setActiveTheme\] = useState\<'organic' \| 'synthetic' \| 'latent'\>\([\s\S]*?\);/,
`const [activeTheme, setActiveTheme] = useState<string>('white editorial');`
);
content = content.replace(
/const themeConfig = THEMES\[activeTheme as keyof typeof THEMES\] \|\| THEMES\['organic'\];/,
`const themeConfig = THEMES[activeTheme as keyof typeof THEMES] || THEMES['white editorial'];`
);
content = content.replace(
/const accentColor = activeTheme === 'synthetic' \? themeConfig\.accent : \(tailor\?\.chromaticRegistry\?\.accentSignal \|\| themeConfig\.accent\);/,
`const accentColor = tailor?.chromaticRegistry?.accentSignal || themeConfig.accent;`
);
fs.writeFileSync(filePath, content, 'utf8');
console.log('Replaced activeTheme');