@hncode/hncode 0.7.5 → 0.7.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hncode/hncode",
3
- "version": "0.7.5",
3
+ "version": "0.7.7",
4
4
  "description": "hncode — A cyan-blue TUI AI coding agent with zero runtime dependencies.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/colors.js CHANGED
@@ -267,6 +267,13 @@ export const C = {
267
267
  // is rgb(48,48,48) = #303030 — clearly lifted off a near-black terminal without
268
268
  // washing the text out. Truecolor gets `#2e2e2e`, the same shade written exactly.
269
269
  bgPanel: TRUECOLOR ? '\x1b[48;2;46;46;46m' : '\x1b[48;5;236m',
270
+ // The code-surface background, set by setTheme from the theme's own page colour. A placeholder until then, so
271
+ // code drawn before the first setTheme still has a surface.
272
+ codeBg: TRUECOLOR ? '\x1b[48;2;12;20;26m' : '\x1b[48;5;233m',
273
+ // The terminal-surface background, set by setTheme from the theme's page colour. Placeholder until then.
274
+ termBg: TRUECOLOR ? '\x1b[48;2;0;14;21m' : '\x1b[48;5;234m',
275
+ // The composer's neutral-grey surface. Placeholder until setTheme runs.
276
+ composerBg: TRUECOLOR ? '\x1b[48;2;44;44;46m' : '\x1b[48;5;237m',
270
277
  border: BORDER,
271
278
  red: '\x1b[91m',
272
279
  green: '\x1b[92m',
@@ -471,6 +478,28 @@ export function setTheme(name) {
471
478
  C.diffAddFg = rgb(...mix(green, t.fg, 0.55));
472
479
  C.diffDelFg = rgb(...mix(red, t.fg, 0.55));
473
480
 
481
+ // THE CODE-SURFACE BACKGROUND, one step off the page. Read rows, Write previews and diff CONTEXT lines sit on
482
+ // it; diff `+`/`-` rows keep their green/red wash on top. Mixed from this theme's own page colour rather than
483
+ // a fixed grey, so a light theme gets a light code surface and a dark one a dark one.
484
+ //
485
+ // The step depends on WHICH SIDE the page is. On a dark page the surface is one step LIGHTER (mix very little
486
+ // foreground in); on a light page it is one step DARKER (mix a little foreground in). Same small distance either
487
+ // way, because a code region must read as "same screen, slightly recessed", not as a panel.
488
+ C.codeBg = brgb(...mix(t.bg, t.fg, isLight ? 0.93 : 0.94));
489
+ // THE TERMINAL-SURFACE BACKGROUND: the same small step on the OTHER side of the page, so the ordering holds on
490
+ // both kinds of theme — page < terminal < code on a dark one, terminal < code < page on a light one. Bash output
491
+ // and the shell-mode echo sit on it: a command reads as "a terminal ran this" without becoming a black band,
492
+ // which is what a deeper well looked like — a hole in the screen rather than a region of it.
493
+ //
494
+ // Towards BLACK on a dark theme and towards the foreground on a light one: mixing a dark page further towards its
495
+ // own foreground would make it lighter, which is `codeBg`'s job, not this one.
496
+ C.termBg = brgb(...mix(t.bg, isLight ? t.fg : [0, 0, 0], isLight ? 0.88 : 0.94));
497
+ // THE COMPOSER SURFACE: a NEUTRAL GREY, not a tint of the page. The input area is the one region that should not
498
+ // follow the theme's hue — a cyan-tinted box on a dark-teal page reads as "more page", while a grey one reads as
499
+ // an input field. Neutral means equal RGB, so it is written as a grey and adjusted only for light vs dark. A
500
+ // theme may override it with its own `composer` triple.
501
+ C.composerBg = brgb(...(t.composer || (isLight ? [232, 232, 232] : [44, 44, 46])));
502
+
474
503
  // A comment: the palette's foreground, pulled most of the way towards its background so it reads as quiet. A dark
475
504
  // page can afford a looser mix; a light one cannot — solar's foreground is already a muted blue-grey, and at the
476
505
  // dark theme's ratio its comments came within 8 of the removal wash.