Something went wrong. Try again.
Monorepo for Aesthetic.Computer aesthetic.computer
Something went wrong. Try again.
4.1 kB ยท 151 lines
JavaScript
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
import fs from 'fs';import path from 'path';
const themeDir = 'vscode-extension/themes';const packageJsonPath = 'vscode-extension/package.json';const templatePath = path.join(themeDir, 'aesthetic-dark-color-theme.json');
const template = fs.readFileSync(templatePath, 'utf8');
// Base colors in the template to replaceconst BASE_ACCENT = 'a87090'; // Mauveconst BASE_BG = '181318'; // Dark Purple Backgroundconst BASE_BG_ALT = '141214'; // Slightly Darker Backgroundconst BASE_BG_DEEP = '101010'; // Deepest Black/Backgroundconst BASE_STATUS = '302030'; // Status Bar Backgroundconst BASE_FOCUS = '584058'; // Focus Border / Button Background
// Helper to replace all occurrences of a color with anotherfunction replaceColor(content, oldHex, newHex) { const regex = new RegExp(oldHex, 'gi'); return content.replace(regex, newHex);}
// Target Palettes// names: Red, Orange, Yellow, Green, Blue, Indigo, Violet, Pinkconst palettes = [ { name: 'Red', emoji: '๐ด', accent: 'ff5555', background: '181010', backgroundAlt: '140c0c', status: '301010', focus: '582020' }, { name: 'Orange', emoji: '๐ ', accent: 'ffb86c', background: '181410', backgroundAlt: '14100c', status: '302010', focus: '584020' }, { name: 'Yellow', emoji: '๐ก', accent: 'f1fa8c', background: '181810', backgroundAlt: '14140c', status: '303010', focus: '585820' }, { name: 'Green', emoji: '๐ข', accent: '50fa7b', background: '101810', backgroundAlt: '0c140c', status: '103010', focus: '205820' }, { name: 'Blue', emoji: '๐ต', accent: '61afef', background: '101418', backgroundAlt: '0c1014', status: '102030', focus: '204058' }, { name: 'Indigo', emoji: '๐ฃ', accent: '6272a4', background: '121018', backgroundAlt: '0e0c14', status: '181030', focus: '302058' }, { name: 'Violet', emoji: '๐ฎ', accent: 'bd93f9', background: '161016', backgroundAlt: '120c12', status: '201020', focus: '402040' }, { name: 'Pink', emoji: '๐ธ', accent: 'ff79c6', background: '181014', backgroundAlt: '140c10', status: '301020', focus: '582040' }, { name: 'Pencil', emoji: 'โ๏ธ', accent: 'e0e0e0', background: '181818', backgroundAlt: '141414', status: '303030', focus: '585858' }];
const generatedThemes = [];
palettes.forEach(palette => { let themeContent = template; // Replace names themeContent = themeContent.replace("Aesthetic Computer: Dark ๐", `Aesthetic Computer: ${palette.name} ${palette.emoji}`); // Replace Colors themeContent = replaceColor(themeContent, BASE_ACCENT, palette.accent); themeContent = replaceColor(themeContent, BASE_BG, palette.background); themeContent = replaceColor(themeContent, BASE_BG_ALT, palette.backgroundAlt); themeContent = replaceColor(themeContent, BASE_STATUS, palette.status); themeContent = replaceColor(themeContent, BASE_FOCUS, palette.focus);
// Write new file const fileName = `aesthetic-${palette.name.toLowerCase()}-color-theme.json`; const filePath = path.join(themeDir, fileName); fs.writeFileSync(filePath, themeContent); console.log(`Generated ${fileName}`);
generatedThemes.push({ label: `Aesthetic Computer: ${palette.name} ${palette.emoji}`, uiTheme: "vs-dark", path: `./themes/${fileName}` });});
// Update package.jsonconst packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
// Filter out existing generated themes to avoid duplicates on re-runconst staticThemes = packageJson.contributes.themes.filter(t => t.label === "Aesthetic Computer: Dark ๐" || t.label === "Aesthetic Computer: Light ๐ป");
packageJson.contributes.themes = [...staticThemes, ...generatedThemes];
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));console.log('Updated package.json');