numux 2.16.2 → 2.17.1

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/dist/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { Color } from './utils/color';
2
+ import type { ThemePref } from './utils/theme';
2
3
  export interface NumuxProcessConfig<K extends string = string> {
3
4
  /** Shell command to run. Supports `$dep.group` references from dependency capture groups */
4
5
  command: string;
@@ -122,6 +123,12 @@ export interface NumuxConfig<K extends string = string> {
122
123
  noWatch?: boolean;
123
124
  /** Directory to write per-process log files */
124
125
  logDir?: string;
126
+ /**
127
+ * TUI color theme. `'auto'` detects the terminal background via OSC 11 (falling back
128
+ * to `COLORFGBG` then dark). `'light'`/`'dark'` skip detection.
129
+ * @default 'auto'
130
+ */
131
+ theme?: ThemePref;
125
132
  processes: Record<K, NumuxProcessConfig<K> | NumuxScriptPattern<K> | string | true>;
126
133
  }
127
134
  export type SortOrder = 'config' | 'alphabetical' | 'topological' | 'status';
@@ -138,6 +145,7 @@ export interface ResolvedNumuxConfig {
138
145
  killOthersOnFail?: boolean;
139
146
  noWatch?: boolean;
140
147
  logDir?: string;
148
+ theme?: ThemePref;
141
149
  processes: Record<string, ResolvedProcessConfig>;
142
150
  }
143
151
  export type ProcessStatus = 'pending' | 'starting' | 'ready' | 'running' | 'stopping' | 'stopped' | 'finished' | 'failed' | 'skipped';
@@ -34,7 +34,7 @@ export declare const ANSI_RESET = "\u001B[0m";
34
34
  export declare function stripAnsi(str: string): string;
35
35
  /** Pick a deterministic color from the default palette based on the process name */
36
36
  export declare function colorFromName(name: string): Color;
37
- /** Build a map of process names to ANSI color codes, using explicit config colors or a default palette. */
38
- export declare function buildProcessColorMap(names: string[], config: ResolvedNumuxConfig): Map<string, string>;
37
+ /** Build a map of process names to ANSI color codes, using explicit config colors or a palette. */
38
+ export declare function buildProcessColorMap(names: string[], config: ResolvedNumuxConfig, palette?: readonly string[]): Map<string, string>;
39
39
  /** Build a map of process names to hex color strings (for StyledText rendering). */
40
- export declare function buildProcessHexColorMap(names: string[], config: ResolvedNumuxConfig): Map<string, string>;
40
+ export declare function buildProcessHexColorMap(names: string[], config: ResolvedNumuxConfig, palette?: readonly string[]): Map<string, string>;
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Light/dark theme resolution. Detects terminal background via OSC 11
3
+ * query, falling back to COLORFGBG env var, then to dark. Explicit
4
+ * user config (`theme: 'light' | 'dark'`) skips detection entirely.
5
+ */
6
+ export type ThemeMode = 'light' | 'dark';
7
+ export type ThemePref = ThemeMode | 'auto';
8
+ export interface StatusColors {
9
+ ready: string;
10
+ failed: string;
11
+ stopped: string;
12
+ finished: string;
13
+ skipped: string;
14
+ }
15
+ export interface Theme {
16
+ mode: ThemeMode;
17
+ statusBarBg: string;
18
+ statusBarText: string;
19
+ helpBackdropBg: string;
20
+ helpBoxBg: string;
21
+ helpBorder: string;
22
+ helpText: string;
23
+ sidebarBg: string;
24
+ sidebarBorder: string;
25
+ tabSelectedBg: string;
26
+ tabSelectedText: string;
27
+ tabText: string;
28
+ tabDescriptionText: string;
29
+ tabSelectedDescriptionText: string;
30
+ scrollTrackBg: string;
31
+ scrollThumbBg: string;
32
+ searchCurrentBg: string;
33
+ searchMatchBg: string;
34
+ palette: readonly string[];
35
+ status: StatusColors;
36
+ inputWaiting: string;
37
+ errorIndicator: string;
38
+ searchMatchTab: string;
39
+ iconDefault: string;
40
+ }
41
+ export declare const DARK_THEME: Theme;
42
+ export declare const LIGHT_THEME: Theme;
43
+ export declare function themeFor(mode: ThemeMode): Theme;
44
+ /** WCAG relative luminance (0–1). */
45
+ export declare function relativeLuminance(r: number, g: number, b: number): number;
46
+ export declare function isLightRgb(r: number, g: number, b: number): boolean;
47
+ /**
48
+ * Parse OSC 11 response body. Accepts `rgb:RRRR/GGGG/BBBB` (4 hex digits,
49
+ * xterm/Ghostty/kitty/alacritty/iTerm2) or 2-digit short form. Returns null
50
+ * on malformed input.
51
+ */
52
+ export declare function parseOSC11Response(data: string): {
53
+ r: number;
54
+ g: number;
55
+ b: number;
56
+ } | null;
57
+ /**
58
+ * Parse COLORFGBG env var (e.g. `"15;0"` = white fg on black bg = dark).
59
+ * Convention: bg index ≥7 is light, otherwise dark. iTerm2 sometimes sets
60
+ * the middle field to `default`; we read the last segment as the bg.
61
+ */
62
+ export declare function parseColorFgBg(value: string | undefined): ThemeMode | null;
63
+ /**
64
+ * Query the terminal's background color via OSC 11. Resolves to `null` on
65
+ * non-TTY, timeout, or unparseable response. Runs synchronously-ish in under
66
+ * `timeoutMs` (default 100ms). Must be called before any renderer takes
67
+ * over stdin.
68
+ */
69
+ export declare function queryOSC11(timeoutMs?: number): Promise<ThemeMode | null>;
70
+ export declare function detectThemeMode(timeoutMs?: number): Promise<ThemeMode | null>;
71
+ /**
72
+ * Resolve final theme. Explicit `'light'`/`'dark'` skips detection;
73
+ * `'auto'` (or undefined) runs detection, falling back to dark.
74
+ */
75
+ export declare function resolveTheme(pref?: ThemePref | undefined): Promise<Theme>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "numux",
3
- "version": "2.16.2",
3
+ "version": "2.17.1",
4
4
  "description": "Terminal multiplexer with dependency orchestration",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -45,8 +45,8 @@
45
45
  "dist/"
46
46
  ],
47
47
  "dependencies": {
48
- "@opentui/core": "^0.1.88",
49
- "ghostty-opentui": "^1.4.7"
48
+ "@opentui/core": "^0.4.1",
49
+ "ghostty-opentui": "^1.5.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@biomejs/biome": "^2.4.4",
@@ -54,8 +54,5 @@
54
54
  "@commitlint/config-conventional": "^20.4.2",
55
55
  "@types/bun": "^1.3.9",
56
56
  "marked-man": "^2.1.0"
57
- },
58
- "patchedDependencies": {
59
- "ghostty-opentui@1.4.7": "patches/ghostty-opentui@1.4.7.patch"
60
57
  }
61
58
  }