ctheme 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/bin/ctheme.js +41 -28
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ The wizard walks through:
|
|
|
77
77
|
- terminal font
|
|
78
78
|
- UI font
|
|
79
79
|
- code font
|
|
80
|
-
- theme summary before save
|
|
80
|
+
- theme summary with color swatches before save
|
|
81
81
|
- optional Google Fonts install
|
|
82
82
|
- optional live apply
|
|
83
83
|
|
|
@@ -157,6 +157,7 @@ solarized, solarized-dark, velvet
|
|
|
157
157
|
|
|
158
158
|
Bundled themes intentionally vary their font pairings so they do not all feel the same.
|
|
159
159
|
The npm install bootstrap preinstalls the curated font set those presets rely on, so the bundled themes render correctly immediately on macOS.
|
|
160
|
+
The default code and terminal font choices are biased toward tighter, denser monospace faces rather than wide-spaced ones.
|
|
160
161
|
|
|
161
162
|
## Contributing
|
|
162
163
|
|
package/bin/ctheme.js
CHANGED
|
@@ -95,8 +95,8 @@ const BUILTIN_THEMES = [
|
|
|
95
95
|
|
|
96
96
|
const FONT_CHOICES = {
|
|
97
97
|
ui: ["Manrope", "Space Grotesk", "Outfit", "Sora", "Plus Jakarta Sans", "Newsreader", "Fraunces", "Bricolage Grotesque", "Urbanist", "Source Sans 3", "IBM Plex Sans", "Instrument Serif", "Syne"],
|
|
98
|
-
code: ["IBM Plex Mono", "
|
|
99
|
-
terminal: ["IBM Plex Mono", "
|
|
98
|
+
code: ["IBM Plex Mono", "Source Code Pro", "JetBrains Mono", "Roboto Mono", "Azeret Mono", "Fira Code", "Ubuntu Mono", "Victor Mono", "DM Mono", "Space Mono"],
|
|
99
|
+
terminal: ["IBM Plex Mono", "Source Code Pro", "JetBrains Mono", "Roboto Mono", "Azeret Mono", "Fira Code", "Ubuntu Mono", "Victor Mono", "DM Mono", "Space Mono"]
|
|
100
100
|
};
|
|
101
101
|
|
|
102
102
|
const PRESETS = {
|
|
@@ -181,7 +181,7 @@ const PRESETS = {
|
|
|
181
181
|
cyan: "#7dd3fc"
|
|
182
182
|
},
|
|
183
183
|
glacier: {
|
|
184
|
-
fonts: { terminal: "
|
|
184
|
+
fonts: { terminal: "Source Code Pro", ui: "Urbanist", code: "Source Code Pro" },
|
|
185
185
|
accent: "#7aa2f7",
|
|
186
186
|
bg: "#0a1220",
|
|
187
187
|
surface: "#121c2f",
|
|
@@ -197,7 +197,7 @@ const PRESETS = {
|
|
|
197
197
|
cyan: "#7dcfff"
|
|
198
198
|
},
|
|
199
199
|
cobalt: {
|
|
200
|
-
fonts: { terminal: "
|
|
200
|
+
fonts: { terminal: "Azeret Mono", ui: "Bricolage Grotesque", code: "Azeret Mono" },
|
|
201
201
|
accent: "#4da3ff",
|
|
202
202
|
bg: "#09111f",
|
|
203
203
|
surface: "#10203a",
|
|
@@ -213,7 +213,7 @@ const PRESETS = {
|
|
|
213
213
|
cyan: "#56ccf2"
|
|
214
214
|
},
|
|
215
215
|
rose: {
|
|
216
|
-
fonts: { terminal: "
|
|
216
|
+
fonts: { terminal: "JetBrains Mono", ui: "Fraunces", code: "JetBrains Mono" },
|
|
217
217
|
accent: "#ea9ab2",
|
|
218
218
|
bg: "#171217",
|
|
219
219
|
surface: "#231b23",
|
|
@@ -229,7 +229,7 @@ const PRESETS = {
|
|
|
229
229
|
cyan: "#8bd3dd"
|
|
230
230
|
},
|
|
231
231
|
lotus: {
|
|
232
|
-
fonts: { terminal: "
|
|
232
|
+
fonts: { terminal: "Roboto Mono", ui: "Instrument Serif", code: "Roboto Mono" },
|
|
233
233
|
accent: "#d16d9e",
|
|
234
234
|
bg: "#fff7f3",
|
|
235
235
|
surface: "#fffdfb",
|
|
@@ -277,7 +277,7 @@ const PRESETS = {
|
|
|
277
277
|
cyan: "#6ee7b7"
|
|
278
278
|
},
|
|
279
279
|
aurora: {
|
|
280
|
-
fonts: { terminal: "
|
|
280
|
+
fonts: { terminal: "JetBrains Mono", ui: "Urbanist", code: "JetBrains Mono" },
|
|
281
281
|
accent: "#7c5cff",
|
|
282
282
|
bg: "#0f0a1f",
|
|
283
283
|
surface: "#181131",
|
|
@@ -293,7 +293,7 @@ const PRESETS = {
|
|
|
293
293
|
cyan: "#7bdff2"
|
|
294
294
|
},
|
|
295
295
|
espresso: {
|
|
296
|
-
fonts: { terminal: "
|
|
296
|
+
fonts: { terminal: "IBM Plex Mono", ui: "Instrument Serif", code: "IBM Plex Mono" },
|
|
297
297
|
accent: "#c67c4e",
|
|
298
298
|
bg: "#120d0b",
|
|
299
299
|
surface: "#1d1512",
|
|
@@ -325,7 +325,7 @@ const PRESETS = {
|
|
|
325
325
|
cyan: "#bde0fe"
|
|
326
326
|
},
|
|
327
327
|
neon: {
|
|
328
|
-
fonts: { terminal: "
|
|
328
|
+
fonts: { terminal: "Roboto Mono", ui: "Bricolage Grotesque", code: "Roboto Mono" },
|
|
329
329
|
accent: "#00f5d4",
|
|
330
330
|
bg: "#090414",
|
|
331
331
|
surface: "#130a24",
|
|
@@ -389,7 +389,7 @@ const PRESETS = {
|
|
|
389
389
|
cyan: "#2aa198"
|
|
390
390
|
},
|
|
391
391
|
velvet: {
|
|
392
|
-
fonts: { terminal: "
|
|
392
|
+
fonts: { terminal: "Azeret Mono", ui: "Fraunces", code: "Azeret Mono" },
|
|
393
393
|
accent: "#d4a5ff",
|
|
394
394
|
bg: "#140d18",
|
|
395
395
|
surface: "#211328",
|
|
@@ -912,6 +912,10 @@ function listInstalledFonts() {
|
|
|
912
912
|
}
|
|
913
913
|
|
|
914
914
|
function installGoogleFont(family) {
|
|
915
|
+
return installGoogleFontWithOptions(family, {});
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
function installGoogleFontWithOptions(family, options = {}) {
|
|
915
919
|
const paths = getThemePaths();
|
|
916
920
|
ensureDir(paths.managedFontDir);
|
|
917
921
|
const installed = downloadGoogleFontFiles(family, paths.managedFontDir);
|
|
@@ -919,13 +923,13 @@ function installGoogleFont(family) {
|
|
|
919
923
|
fail(`No installable font files found for ${family}`);
|
|
920
924
|
}
|
|
921
925
|
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
console.log("Warning: this family looks proportional. It may render poorly in terminal grids.");
|
|
926
|
+
if (!options.quiet) {
|
|
927
|
+
console.log(`Installed ${family} into ${paths.managedFontDir}`);
|
|
928
|
+
for (const file of installed) {
|
|
929
|
+
console.log(`- ${file}`);
|
|
930
|
+
}
|
|
928
931
|
}
|
|
932
|
+
return installed;
|
|
929
933
|
}
|
|
930
934
|
|
|
931
935
|
function searchGoogleFonts(query) {
|
|
@@ -951,8 +955,7 @@ function searchGoogleFonts(query) {
|
|
|
951
955
|
}
|
|
952
956
|
|
|
953
957
|
for (const font of matches) {
|
|
954
|
-
|
|
955
|
-
console.log(`${font.family} (${mono})`);
|
|
958
|
+
console.log(font.family);
|
|
956
959
|
}
|
|
957
960
|
}
|
|
958
961
|
|
|
@@ -993,12 +996,13 @@ function downloadGoogleFontFiles(family, targetDir) {
|
|
|
993
996
|
execFileSync("curl", [
|
|
994
997
|
"-L",
|
|
995
998
|
"--fail",
|
|
999
|
+
"-sS",
|
|
996
1000
|
"-H",
|
|
997
1001
|
"User-Agent: pretty-code",
|
|
998
1002
|
"--output",
|
|
999
1003
|
destPath,
|
|
1000
1004
|
entry.download_url
|
|
1001
|
-
], { stdio: "
|
|
1005
|
+
], { stdio: "pipe" });
|
|
1002
1006
|
installed.push(destPath);
|
|
1003
1007
|
}
|
|
1004
1008
|
|
|
@@ -1209,30 +1213,39 @@ async function promptYesNo(rl, label, defaultValue) {
|
|
|
1209
1213
|
}
|
|
1210
1214
|
|
|
1211
1215
|
function installFontsBestEffort(fonts) {
|
|
1216
|
+
const installedFamilies = [];
|
|
1212
1217
|
for (const family of [...new Set(fonts.filter(Boolean))]) {
|
|
1213
1218
|
try {
|
|
1214
|
-
|
|
1219
|
+
installGoogleFontWithOptions(family, { quiet: true });
|
|
1220
|
+
installedFamilies.push(family);
|
|
1215
1221
|
} catch (error) {
|
|
1216
|
-
console.log(`Skipped
|
|
1222
|
+
console.log(`Skipped ${family}`);
|
|
1217
1223
|
}
|
|
1218
1224
|
}
|
|
1225
|
+
if (installedFamilies.length) {
|
|
1226
|
+
console.log(`Installed fonts: ${installedFamilies.join(", ")}`);
|
|
1227
|
+
}
|
|
1219
1228
|
}
|
|
1220
1229
|
|
|
1221
1230
|
function printThemeSummary(theme) {
|
|
1222
1231
|
console.log(` name: ${theme.name}`);
|
|
1223
1232
|
console.log(` preset: ${theme.preset}`);
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1233
|
+
printColorLine("accent", theme.accent);
|
|
1234
|
+
printColorLine("bg", theme.bg);
|
|
1235
|
+
printColorLine("surface", theme.surface);
|
|
1236
|
+
printColorLine("surface alt", theme.surfaceAlt);
|
|
1237
|
+
printColorLine("text", theme.fg);
|
|
1238
|
+
printColorLine("muted", theme.muted);
|
|
1239
|
+
printColorLine("dim", theme.dim);
|
|
1231
1240
|
console.log(` terminal font: ${theme.fonts.terminal}`);
|
|
1232
1241
|
console.log(` ui font: ${theme.fonts.ui}`);
|
|
1233
1242
|
console.log(` code font: ${theme.fonts.code}`);
|
|
1234
1243
|
}
|
|
1235
1244
|
|
|
1245
|
+
function printColorLine(label, hex) {
|
|
1246
|
+
console.log(` ${label}: ${colorBlock(hex, 8)} ${hex}`);
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1236
1249
|
function writeThemeAssets(paths, name, palette) {
|
|
1237
1250
|
ensureDir(paths.paletteDir);
|
|
1238
1251
|
fs.writeFileSync(path.join(paths.paletteDir, `${name}.json`), `${JSON.stringify(palette, null, 2)}\n`, "utf8");
|