Monorepo for Aesthetic.Computer
aesthetic.computer
1
2import fs from 'fs';
3import path from 'path';
4
5const themeDir = 'vscode-extension/themes';
6const packageJsonPath = 'vscode-extension/package.json';
7const templatePath = path.join(themeDir, 'aesthetic-dark-color-theme.json');
8
9const template = fs.readFileSync(templatePath, 'utf8');
10
11// Base colors in the template to replace
12const BASE_ACCENT = 'a87090'; // Mauve
13const BASE_BG = '181318'; // Dark Purple Background
14const BASE_BG_ALT = '141214'; // Slightly Darker Background
15const BASE_BG_DEEP = '101010'; // Deepest Black/Background
16const BASE_STATUS = '302030'; // Status Bar Background
17const BASE_FOCUS = '584058'; // Focus Border / Button Background
18
19// Helper to replace all occurrences of a color with another
20function replaceColor(content, oldHex, newHex) {
21 const regex = new RegExp(oldHex, 'gi');
22 return content.replace(regex, newHex);
23}
24
25// Target Palettes
26// names: Red, Orange, Yellow, Green, Blue, Indigo, Violet, Pink
27const palettes = [
28 {
29 name: 'Red',
30 emoji: '🔴',
31 accent: 'ff5555',
32 background: '181010',
33 backgroundAlt: '140c0c',
34 status: '301010',
35 focus: '582020'
36 },
37 {
38 name: 'Orange',
39 emoji: '🟠',
40 accent: 'ffb86c',
41 background: '181410',
42 backgroundAlt: '14100c',
43 status: '302010',
44 focus: '584020'
45 },
46 {
47 name: 'Yellow',
48 emoji: '🟡',
49 accent: 'f1fa8c',
50 background: '181810',
51 backgroundAlt: '14140c',
52 status: '303010',
53 focus: '585820'
54 },
55 {
56 name: 'Green',
57 emoji: '🟢',
58 accent: '50fa7b',
59 background: '101810',
60 backgroundAlt: '0c140c',
61 status: '103010',
62 focus: '205820'
63 },
64 {
65 name: 'Blue',
66 emoji: '🔵',
67 accent: '61afef',
68 background: '101418',
69 backgroundAlt: '0c1014',
70 status: '102030',
71 focus: '204058'
72 },
73 {
74 name: 'Indigo',
75 emoji: '🟣',
76 accent: '6272a4',
77 background: '121018',
78 backgroundAlt: '0e0c14',
79 status: '181030',
80 focus: '302058'
81 },
82 {
83 name: 'Violet',
84 emoji: '🔮',
85 accent: 'bd93f9',
86 background: '161016',
87 backgroundAlt: '120c12',
88 status: '201020',
89 focus: '402040'
90 },
91 {
92 name: 'Pink',
93 emoji: '🌸',
94 accent: 'ff79c6',
95 background: '181014',
96 backgroundAlt: '140c10',
97 status: '301020',
98 focus: '582040'
99 },
100 {
101 name: 'Pencil',
102 emoji: '✏️',
103 accent: 'e0e0e0',
104 background: '181818',
105 backgroundAlt: '141414',
106 status: '303030',
107 focus: '585858'
108 }
109];
110
111const generatedThemes = [];
112
113palettes.forEach(palette => {
114 let themeContent = template;
115
116 // Replace names
117 themeContent = themeContent.replace("Aesthetic Computer: Dark 🌑", `Aesthetic Computer: ${palette.name} ${palette.emoji}`);
118
119 // Replace Colors
120 themeContent = replaceColor(themeContent, BASE_ACCENT, palette.accent);
121 themeContent = replaceColor(themeContent, BASE_BG, palette.background);
122 themeContent = replaceColor(themeContent, BASE_BG_ALT, palette.backgroundAlt);
123 themeContent = replaceColor(themeContent, BASE_STATUS, palette.status);
124 themeContent = replaceColor(themeContent, BASE_FOCUS, palette.focus);
125
126 // Write new file
127 const fileName = `aesthetic-${palette.name.toLowerCase()}-color-theme.json`;
128 const filePath = path.join(themeDir, fileName);
129 fs.writeFileSync(filePath, themeContent);
130 console.log(`Generated ${fileName}`);
131
132 generatedThemes.push({
133 label: `Aesthetic Computer: ${palette.name} ${palette.emoji}`,
134 uiTheme: "vs-dark",
135 path: `./themes/${fileName}`
136 });
137});
138
139// Update package.json
140const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
141
142// Filter out existing generated themes to avoid duplicates on re-run
143const staticThemes = packageJson.contributes.themes.filter(t =>
144 t.label === "Aesthetic Computer: Dark 🌑" ||
145 t.label === "Aesthetic Computer: Light 🌻"
146);
147
148packageJson.contributes.themes = [...staticThemes, ...generatedThemes];
149
150fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
151console.log('Updated package.json');