ctheme 0.1.2 → 0.1.3

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/bin/ctheme.js +31 -18
  3. 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
 
package/bin/ctheme.js CHANGED
@@ -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
- console.log(`Installed ${family} into ${paths.managedFontDir}`);
923
- for (const file of installed) {
924
- console.log(`- ${file}`);
925
- }
926
- if (!looksMonospaceFamily(family)) {
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
- const mono = looksMonospaceFamily(font.family) ? "mono-ish" : "proportional";
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: "inherit" });
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
- installGoogleFont(family);
1219
+ installGoogleFontWithOptions(family, { quiet: true });
1220
+ installedFamilies.push(family);
1215
1221
  } catch (error) {
1216
- console.log(`Skipped Google Fonts install for ${family}: ${error instanceof Error ? error.message : String(error)}`);
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
- console.log(` accent: ${theme.accent}`);
1225
- console.log(` bg: ${theme.bg}`);
1226
- console.log(` surface: ${theme.surface}`);
1227
- console.log(` surface alt: ${theme.surfaceAlt}`);
1228
- console.log(` text: ${theme.fg}`);
1229
- console.log(` muted: ${theme.muted}`);
1230
- console.log(` dim: ${theme.dim}`);
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");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ctheme",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Theme manager for making terminals look better with colors, fonts, and live profile switching",
5
5
  "license": "MIT",
6
6
  "repository": {