dsh-code 1.0.7 → 1.3.0

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 (89) hide show
  1. package/README.en.md +70 -24
  2. package/README.md +71 -25
  3. package/bin/deepseek.mjs +202 -39
  4. package/cordis.patch.yml +13 -4
  5. package/lib/index.mjs +5002 -1061
  6. package/lib/session-query.mjs +3 -2
  7. package/lib/startup.mjs +4 -4
  8. package/lib/{theme-DCT8Y2xf.mjs → theme-B3orFUYz.mjs} +665 -20
  9. package/lib/types/app.d.ts +120 -63
  10. package/lib/types/attachments.d.ts +16 -7
  11. package/lib/types/authorization-panel.d.ts +3 -3
  12. package/lib/types/git-workflow.d.ts +91 -2
  13. package/lib/types/history.d.ts +10 -0
  14. package/lib/types/i18n.d.ts +39 -0
  15. package/lib/types/index.d.ts +74 -2
  16. package/lib/types/input-split.d.ts +1 -1
  17. package/lib/types/kernel-panels.d.ts +89 -32
  18. package/lib/types/language-panel.d.ts +12 -0
  19. package/lib/types/locales/en.d.ts +498 -0
  20. package/lib/types/locales/zh.d.ts +9 -0
  21. package/lib/types/mentions.d.ts +7 -3
  22. package/lib/types/models.d.ts +14 -0
  23. package/lib/types/panel-accent.d.ts +28 -0
  24. package/lib/types/rainbow.d.ts +69 -0
  25. package/lib/types/render/animations.d.ts +42 -0
  26. package/lib/types/render/inspector.d.ts +26 -0
  27. package/lib/types/render/lines.d.ts +21 -1
  28. package/lib/types/render/markdown.d.ts +1 -1
  29. package/lib/types/render/projection.d.ts +95 -4
  30. package/lib/types/render/status.d.ts +12 -9
  31. package/lib/types/render/text.d.ts +6 -0
  32. package/lib/types/render/usage.d.ts +113 -0
  33. package/lib/types/session-directory.d.ts +42 -1
  34. package/lib/types/session-switch.d.ts +8 -0
  35. package/lib/types/startup.d.ts +1 -1
  36. package/lib/types/terminal-title.d.ts +8 -0
  37. package/lib/types/theme-panel.d.ts +2 -2
  38. package/lib/types/theme.d.ts +271 -52
  39. package/lib/types/update-panel.d.ts +27 -6
  40. package/lib/types/update.d.ts +10 -1
  41. package/lib/types/version.d.ts +6 -3
  42. package/package.json +26 -7
  43. package/src/app.ts +1426 -627
  44. package/src/approval.ts +166 -166
  45. package/src/attachments.ts +65 -19
  46. package/src/authorization-panel.ts +24 -18
  47. package/src/editor-keys.ts +371 -371
  48. package/src/fork.ts +11 -7
  49. package/src/git-workflow.ts +229 -3
  50. package/src/history.ts +14 -0
  51. package/src/i18n.ts +68 -0
  52. package/src/index.ts +503 -128
  53. package/src/input-split.ts +27 -7
  54. package/src/kernel-panels.ts +528 -113
  55. package/src/keyboard.ts +5 -4
  56. package/src/language-panel.ts +53 -0
  57. package/src/locales/en.ts +538 -0
  58. package/src/locales/zh.ts +537 -0
  59. package/src/mentions.ts +8 -4
  60. package/src/models.ts +264 -212
  61. package/src/panel-accent.ts +41 -0
  62. package/src/presets.ts +1 -1
  63. package/src/provider-settings.ts +1 -1
  64. package/src/rainbow.ts +218 -0
  65. package/src/render/animations.ts +104 -6
  66. package/src/render/editor.ts +20 -20
  67. package/src/render/export.ts +116 -95
  68. package/src/render/inspector.ts +42 -0
  69. package/src/render/lines.ts +628 -415
  70. package/src/render/markdown.ts +15 -3
  71. package/src/render/projection.ts +429 -19
  72. package/src/render/status.ts +119 -62
  73. package/src/render/text.ts +15 -0
  74. package/src/render/tool-preview.ts +77 -77
  75. package/src/render/usage.ts +430 -0
  76. package/src/render/width.ts +2 -2
  77. package/src/session-directory.ts +90 -9
  78. package/src/session-query.ts +8 -4
  79. package/src/session-switch.ts +14 -0
  80. package/src/startup.ts +3 -3
  81. package/src/store.ts +19 -1
  82. package/src/subagents.ts +229 -229
  83. package/src/terminal-title.ts +22 -5
  84. package/src/theme-panel.ts +17 -21
  85. package/src/theme.ts +281 -33
  86. package/src/update-panel.ts +148 -31
  87. package/src/update.ts +19 -3
  88. package/src/version.ts +63 -20
  89. package/src/whale-glyph.ts +23 -23
package/src/theme.ts CHANGED
@@ -4,19 +4,20 @@
4
4
  * (`packages/client/ui-theme/src/styles/design-platform.css`). Truecolor RGB
5
5
  * rides chalk, which degrades automatically on terminals without truecolor.
6
6
  *
7
- * Two palettes — `dark` (the default) and `light` — share the same token keys
8
- * with different values. Painters and the palette accessor read the ACTIVE
7
+ * Three palettes — `dark` (the default), `light`, and `prismatic` (the
8
+ * neon synthwave skin) share the same token keys with different values.
9
+ * Painters and the palette accessor read the ACTIVE
9
10
  * palette selected through {@link setTheme}, so a theme switch recolors every
10
- * painted surface on the next render without touching call sites. Raw token
11
- * consumers keep reading {@link TUI_RGB} (the dark values) until the
12
- * theme-aware integration replaces those call sites with
13
- * `inkColor(getPalette().token)`.
11
+ * painted surface on the next render without touching call sites; consumers
12
+ * read colors through {@link getPalette} or the painters below only.
14
13
  *
15
14
  * @module @deepseek-ai/dsh-tui/theme
16
15
  */
17
16
 
18
17
  import chalk from 'chalk'
19
18
 
19
+ import { rainbowRoll } from './rainbow.ts'
20
+
20
21
  /** One RGB triple for a palette token. */
21
22
  export type RgbTriple = readonly [number, number, number]
22
23
 
@@ -33,15 +34,46 @@ export type ThemeToken =
33
34
  | 'text'
34
35
  | 'code'
35
36
  | 'composerBand'
37
+ | 'diffAdd'
38
+ | 'diffDel'
39
+ | 'diffAddFg'
40
+ | 'diffDelFg'
41
+ | 'surface'
42
+ | 'prompt'
43
+ | 'queued'
44
+ | 'steered'
36
45
 
37
46
  /** One full color palette: every token key mapped to an RGB triple. */
38
47
  export type ThemePalette = Readonly<Record<ThemeToken, RgbTriple>>
39
48
 
40
- /** Selectable theme names: dark, light, or auto (terminal-sensed). */
41
- export type ThemeName = 'dark' | 'light' | 'auto'
49
+ /** Selectable theme names: dark, light, prismatic, rainbow, or auto (terminal-sensed). */
50
+ export type ThemeName = 'dark' | 'light' | 'prismatic' | 'rainbow' | 'auto'
42
51
 
43
52
  /** Valid theme names in canonical picker order. */
44
- export const THEME_NAMES: readonly ThemeName[] = ['dark', 'light', 'auto']
53
+ export const THEME_NAMES: readonly ThemeName[] = ['dark', 'light', 'prismatic', 'rainbow', 'auto']
54
+
55
+ /** One /theme picker row: the theme id plus its display copy. */
56
+ export interface ThemeDescriptor {
57
+ /** The selectable theme name. */
58
+ readonly id: ThemeName
59
+ /** Short row label shown in the picker. */
60
+ readonly label: string
61
+ /** One-line description shown after the label. */
62
+ readonly description: string
63
+ }
64
+
65
+ /**
66
+ * Every theme's picker metadata in canonical order — the single source the
67
+ * /theme panel rows derive from; {@link THEME_NAMES} stays the validation
68
+ * list. Adding a theme means adding its palette plus one row here.
69
+ */
70
+ export const THEMES: readonly ThemeDescriptor[] = [
71
+ { id: 'dark', label: 'dark', description: 'DeepSeek dark palette (default)' },
72
+ { id: 'light', label: 'light', description: 'light palette for bright terminals' },
73
+ { id: 'prismatic', label: 'prismatic', description: 'neon synthwave palette (violet/magenta/cyan)' },
74
+ { id: 'rainbow', label: 'rainbow', description: 'randomized carnival palette (/rainbow to reroll)' },
75
+ { id: 'auto', label: 'auto', description: 'follow the terminal; dark until detection lands' },
76
+ ]
45
77
 
46
78
  /**
47
79
  * DeepSeek dark palette: the original TUI colors, one entry per
@@ -71,16 +103,35 @@ export const DARK_PALETTE = {
71
103
  code: [125, 211, 252],
72
104
  /** Composer three-row band base — neutral light gray, hue-free so wave tints read on it. */
73
105
  composerBand: [46, 48, 52],
106
+ /** Diff added-line background — Codex's muted dark green tint (#213A2B). */
107
+ diffAdd: [33, 58, 43],
108
+ /** Diff removed-line background — Codex's muted dark red tint (#4A221D). */
109
+ diffDel: [74, 34, 29],
110
+ /** Diff added-line foreground — green-500, 5.4:1 on the diffAdd tint. */
111
+ diffAddFg: [34, 197, 94],
112
+ /** Diff removed-line foreground — red-400, 4.9:1 on the diffDel tint (error's red-500 sinks to 3.6:1 on it). */
113
+ diffDelFg: [248, 113, 113],
114
+ /** Terminal background this palette is designed against; row tints blend toward it. */
115
+ surface: [0, 0, 0],
116
+ /**
117
+ * The three prompt-row colors, one per delivery kind. They are the palette's
118
+ * own accents (bright brand, warning amber, violet) rather than fixed RGBs,
119
+ * and every row's bar is these colors laid over {@link surface}.
120
+ */
121
+ prompt: [103, 158, 254],
122
+ queued: [245, 158, 11],
123
+ steered: [167, 139, 250],
74
124
  } as const satisfies ThemePalette
75
125
 
76
126
  /**
77
127
  * Light palette tuned for white terminals: the same token keys as dark with
78
128
  * contrast-driven values (AA on a white background). Brand keeps its dark
79
- * value (≈4.9:1); the bright/mid/deep blues, muted grays, and status colors
80
- * deepen so they stay legible on bright backgrounds.
129
+ * value (≈4.2:1 on white reserved for bold/accent spans; body-size brand
130
+ * text uses brandBright at ≈5.4:1); the bright/mid/deep blues, muted grays,
131
+ * and status colors deepen so they stay legible on bright backgrounds.
81
132
  */
82
133
  export const LIGHT_PALETTE = {
83
- /** Primary brand blue — unchanged, ≈4.9:1 AA on white. */
134
+ /** Primary brand blue — unchanged design-platform value; ≈4.2:1 on white, so bold/accent spans only (body-size brand text uses brandBright). */
84
135
  brand: [65, 118, 230],
85
136
  /** Brighter brand blue deepened for white backgrounds (was 2.7:1). */
86
137
  brandBright: [72, 104, 178],
@@ -102,24 +153,84 @@ export const LIGHT_PALETTE = {
102
153
  code: [14, 116, 144],
103
154
  /** Composer three-row band base — neutral light gray, hue-free so wave tints read on it. */
104
155
  composerBand: [229, 231, 235],
156
+ /** Diff added-line background — GitHub's pastel green (#dafbe1), Codex's light pick. */
157
+ diffAdd: [218, 251, 225],
158
+ /** Diff removed-line background — GitHub's pastel red (#ffebe9), Codex's light pick. */
159
+ diffDel: [255, 235, 233],
160
+ /** Diff added-line foreground — green-800, 6.4:1 on the pastel tint (green-700 clears 4.5:1 by a hair). */
161
+ diffAddFg: [22, 101, 52],
162
+ /** Diff removed-line foreground — red-700, 5.6:1 on the pastel tint (error's red-600 is 3.9:1). */
163
+ diffDelFg: [185, 28, 28],
164
+ /** Terminal background this palette is designed against; row tints blend toward it. */
165
+ surface: [255, 255, 255],
166
+ /**
167
+ * Prompt-row colors deepened for white: the amber and violet the dark theme
168
+ * uses sit at the AA edge on their own pastel bars, so each kind carries a
169
+ * value that clears 4.5:1 both on the bar and on plain white.
170
+ */
171
+ prompt: [47, 76, 143],
172
+ queued: [124, 53, 10],
173
+ steered: [109, 40, 217],
105
174
  } as const satisfies ThemePalette
106
175
 
107
- /** Every palette by theme name; auto resolves through {@link resolveTheme}. */
108
- export const PALETTES = {
109
- dark: DARK_PALETTE,
110
- light: LIGHT_PALETTE,
111
- } as const satisfies Record<Exclude<ThemeName, 'auto'>, ThemePalette>
176
+ /**
177
+ * Prismatic palette — the neon synthwave skin (docs/prismatic-theme-design.md):
178
+ * electric violet replaces the brand blues, neon fuchsia carries live
179
+ * emphasis, neon cyan paints code, and a lavender gray dims captions. Paints
180
+ * on a black terminal; every value meets the same WCAG thresholds as the
181
+ * other palettes (body tokens ≥4.5:1, accents ≥3:1 on pure black). Semantic
182
+ * colors — success/error/warn and the four diff tokens — reuse the dark
183
+ * values verbatim so green still means added and red still means removed.
184
+ */
185
+ export const PRISMATIC_PALETTE = {
186
+ /** Primary electric purple — violet-500 (#8B5CF6), 5.0:1 on black. */
187
+ brand: [139, 92, 246],
188
+ /** Live/streaming emphasis — neon fuchsia-300 (#F0ABFC), 11.9:1 on black. */
189
+ brandBright: [240, 171, 252],
190
+ /** Intermediate violet — violet-400 (#A78BFA), 7.7:1 on black. */
191
+ brandMid: [167, 139, 250],
192
+ /** Deep secondary chrome — violet-600 (#7C3AED), 3.7:1 on black (violet-700 misses 3:1). */
193
+ brandDeep: [124, 58, 237],
194
+ /** Muted captions — lavender gray (#A6A3B8), 8.6:1 on black. */
195
+ dim: [166, 163, 184],
196
+ /** Success green — unchanged from dark. */
197
+ success: [34, 197, 94],
198
+ /** Error red — unchanged from dark. */
199
+ error: [239, 68, 68],
200
+ /** Warning amber — unchanged from dark. */
201
+ warn: [245, 158, 11],
202
+ /** Default foreground text — white with a lavender cast (#F0EEF9). */
203
+ text: [240, 238, 249],
204
+ /** Inline/fenced code — neon cyan-300 (#67E8F9), 14.5:1 on black. */
205
+ code: [103, 232, 249],
206
+ /** Composer three-row band base — neutral dark gray, hue-free so wave tints read on it. */
207
+ composerBand: [46, 46, 52],
208
+ /** Diff added-line background — unchanged from dark. */
209
+ diffAdd: [33, 58, 43],
210
+ /** Diff removed-line background — unchanged from dark. */
211
+ diffDel: [74, 34, 29],
212
+ /** Diff added-line foreground — unchanged from dark. */
213
+ diffAddFg: [34, 197, 94],
214
+ /** Diff removed-line foreground — unchanged from dark. */
215
+ diffDelFg: [248, 113, 113],
216
+ /** Terminal background this palette is designed against; row tints blend toward it. */
217
+ surface: [0, 0, 0],
218
+ /** Prompt rows in the skin's own neon: fuchsia, amber, cyan. */
219
+ prompt: [240, 171, 252],
220
+ queued: [245, 158, 11],
221
+ steered: [103, 232, 249],
222
+ } as const satisfies ThemePalette
112
223
 
113
224
  /**
114
- * The dark palette under its original name: call sites that predate the
115
- * two-palette switch keep compiling and painting identically (the default
116
- * theme IS dark). New code should read the active palette through
117
- * {@link getPalette} so a theme switch reaches it.
118
- *
119
- * @deprecated Read the active palette through {@link getPalette}; this
120
- * compatibility alias is removed in the next minor release.
225
+ * Every STATIC palette by theme name; auto resolves through {@link resolveTheme}
226
+ * and rainbow is rolled per launch ({@link rainbowRoll}), so neither lives
227
+ * here {@link setTheme} resolves both through the same key space.
121
228
  */
122
- export const TUI_RGB = DARK_PALETTE
229
+ export const PALETTES = {
230
+ dark: DARK_PALETTE,
231
+ light: LIGHT_PALETTE,
232
+ prismatic: PRISMATIC_PALETTE,
233
+ } as const satisfies Record<Exclude<ThemeName, 'auto' | 'rainbow'>, ThemePalette>
123
234
 
124
235
  /** The theme name in force (the requested name; 'auto' included). */
125
236
  let activeName: ThemeName = 'dark'
@@ -130,12 +241,13 @@ let activePalette: ThemePalette = DARK_PALETTE
130
241
  /**
131
242
  * Resolve a theme name to the palette actually in use. `auto` detection
132
243
  * (OSC 11 terminal background query) is a later enhancement; until it lands,
133
- * auto falls back to the dark palette.
244
+ * auto falls back to the dark palette (prismatic and rainbow are always
245
+ * explicit choices, never auto-resolved).
134
246
  * @param name - the requested theme name.
135
- * @returns 'dark' or 'light' — the palette key to paint with.
247
+ * @returns 'dark', 'light', 'prismatic', or 'rainbow' — the palette key.
136
248
  */
137
- export function resolveTheme(name: ThemeName): 'dark' | 'light' {
138
- return name === 'light' ? 'light' : 'dark'
249
+ export function resolveTheme(name: ThemeName): 'dark' | 'light' | 'prismatic' | 'rainbow' {
250
+ return name === 'light' ? 'light' : name === 'prismatic' ? 'prismatic' : name === 'rainbow' ? 'rainbow' : 'dark'
139
251
  }
140
252
 
141
253
  /**
@@ -146,7 +258,8 @@ export function resolveTheme(name: ThemeName): 'dark' | 'light' {
146
258
  */
147
259
  export function setTheme(name: ThemeName): void {
148
260
  activeName = name
149
- activePalette = PALETTES[resolveTheme(name)]
261
+ const resolved = resolveTheme(name)
262
+ activePalette = resolved === 'rainbow' ? rainbowRoll().palette : PALETTES[resolved]
150
263
  }
151
264
 
152
265
  /**
@@ -164,13 +277,15 @@ export function getPalette(): ThemePalette {
164
277
  }
165
278
 
166
279
  /**
167
- * Parse a persisted theme name: only 'light' and 'auto' survive; anything
168
- * else (missing, corrupt, or unknown) falls back to the dark default.
280
+ * Parse a persisted theme name: only names in {@link THEME_NAMES} survive;
281
+ * anything else (missing, corrupt, or unknown) falls back to the dark default.
169
282
  * @param value - the raw parsed JSON value (expected string).
170
283
  * @returns a valid theme name.
171
284
  */
172
285
  export function parseThemeName(value: unknown): ThemeName {
173
- return value === 'light' || value === 'auto' ? value : 'dark'
286
+ return typeof value === 'string' && (THEME_NAMES as readonly string[]).includes(value)
287
+ ? (value as ThemeName)
288
+ : 'dark'
174
289
  }
175
290
 
176
291
  /** Ink `color` string for one RGB triple. */
@@ -178,6 +293,139 @@ export function inkColor(triple: RgbTriple): string {
178
293
  return `rgb(${triple[0]}, ${triple[1]}, ${triple[2]})`
179
294
  }
180
295
 
296
+ /**
297
+ * Diff-line background as an Ink `backgroundColor` string, theme-aware and
298
+ * depth-gated (the Codex diff renderer's rule): 16-color terminals paint
299
+ * backgrounds from the saturated system palette, which drowns the text, so
300
+ * they keep the foreground-only look; 256-color and truecolor terminals get
301
+ * the palette's tint (chalk quantizes the RGB form down automatically).
302
+ * @param token - which diff background, added or removed lines.
303
+ * @returns the Ink background color, or undefined to paint foreground-only.
304
+ */
305
+ export function diffBackground(token: 'diffAdd' | 'diffDel'): string | undefined {
306
+ if (chalk.level < 2) return undefined
307
+ return inkColor(activePalette[token])
308
+ }
309
+
310
+ /** One prompt-row color: the palette token whose color paints the row. */
311
+ export interface PromptRowTokens {
312
+ readonly fg: 'prompt' | 'queued' | 'steered'
313
+ }
314
+
315
+ /** How far one prompt-row tint leans toward its color, over the surface. */
316
+ const PROMPT_ROW_TINT = 0.22
317
+
318
+ /**
319
+ * The color family one prompt row wears, chosen by how it was delivered: the
320
+ * ordinary brand accent, the warning amber for a queued prompt, and the
321
+ * palette's own third accent for a steered one. The bar behind it is derived
322
+ * from that same color, so every theme — including a freshly rolled rainbow —
323
+ * carries its own look instead of a fixed triple.
324
+ * @param delivery - how the prompt was delivered; undefined is an ordinary one.
325
+ * @returns the palette token whose color paints the row.
326
+ */
327
+ export function promptRowTokens(delivery: 'queued' | 'steered' | undefined): PromptRowTokens {
328
+ if (delivery === 'queued') return { fg: 'queued' }
329
+ if (delivery === 'steered') return { fg: 'steered' }
330
+ return { fg: 'prompt' }
331
+ }
332
+
333
+ /**
334
+ * Blended prompt-row background for one row color: the palette color laid
335
+ * over the surface the palette is designed for (dark themes over black, light
336
+ * over white), depth-gated exactly like {@link diffBackground} — a 16-color
337
+ * terminal keeps the foreground-only look rather than painting a saturated
338
+ * system background behind the text.
339
+ * @param color - the row's palette token.
340
+ * @returns the Ink background color, or undefined to paint foreground-only.
341
+ */
342
+ export function rowBackground(color: PromptRowTokens['fg']): string | undefined {
343
+ if (chalk.level < 2) return undefined
344
+ const surface = activePalette.surface
345
+ const tint = activePalette[color]
346
+ const blend = (index: number): number =>
347
+ Math.round(surface[index] + (tint[index] - surface[index]) * PROMPT_ROW_TINT)
348
+ return inkColor([blend(0), blend(1), blend(2)] as RgbTriple)
349
+ }
350
+
351
+ /**
352
+ * The prismatic surface ring: four neon accents panels cycle through by
353
+ * mount order (cyan → fuchsia → violet → lime), all ≥3:1 on black. Dark and
354
+ * light ignore the ring — {@link surfaceAccent} falls back to the passed-in
355
+ * base color so those themes stay pixel-identical.
356
+ */
357
+ export const ACCENT_RING: readonly RgbTriple[] = [
358
+ [34, 211, 238],
359
+ [232, 121, 249],
360
+ [167, 139, 250],
361
+ [163, 230, 53],
362
+ ]
363
+
364
+ /**
365
+ * The prismatic flow anchors: brand violet → neon fuchsia → neon cyan. All
366
+ * three clear 4.5:1 on black, so a flowing foreground stays AA throughout
367
+ * the oscillation (render/animations.ts walks the triangle).
368
+ */
369
+ export const FLOW_ANCHORS: readonly RgbTriple[] = [
370
+ [139, 92, 246],
371
+ [232, 121, 249],
372
+ [34, 211, 238],
373
+ ]
374
+
375
+ /**
376
+ * Whether the active theme is prismatic (the neon skin with surface rings
377
+ * and flowing accents).
378
+ */
379
+ export function isPrismatic(): boolean {
380
+ return activeName === 'prismatic'
381
+ }
382
+
383
+ /** Whether the active theme is rainbow (the per-launch carnival roll). */
384
+ export function isRainbow(): boolean {
385
+ return activeName === 'rainbow'
386
+ }
387
+
388
+ /** The active theme's flow walk, if it has one (anchors plus phase offset). */
389
+ export interface ThemeFlow {
390
+ /** Anchor colors walked in order over one 2.4s lap. */
391
+ readonly anchors: readonly RgbTriple[]
392
+ /** Phase offset into the lap, milliseconds (0 for prismatic). */
393
+ readonly phaseMs: number
394
+ }
395
+
396
+ /**
397
+ * The flowing theme's anchor walk: prismatic rides the fixed violet→fuchsia→
398
+ * cyan triangle; rainbow rides its rolled full-spectrum anchors with a random
399
+ * phase; dark and light have no flow (undefined) and keep static accents.
400
+ */
401
+ export function themeFlow(): ThemeFlow | undefined {
402
+ if (isPrismatic()) return { anchors: FLOW_ANCHORS, phaseMs: 0 }
403
+ if (isRainbow()) {
404
+ const roll = rainbowRoll()
405
+ return { anchors: roll.flowAnchors, phaseMs: roll.flowPhaseMs }
406
+ }
407
+ return undefined
408
+ }
409
+
410
+ /**
411
+ * The accent for one surface slot: prismatic rotates the {@link ACCENT_RING}
412
+ * by slot index; every other theme gets the caller's base color back.
413
+ * @param index - the slot's position in the mount-order sequence.
414
+ * @param base - the color to use outside prismatic (the surface's usual one).
415
+ * @returns the accent to paint the surface's border/title with.
416
+ */
417
+ export function surfaceAccent(index: number, base: RgbTriple): RgbTriple {
418
+ if (isPrismatic()) {
419
+ const ring = ACCENT_RING
420
+ return ring[((index % ring.length) + ring.length) % ring.length]
421
+ }
422
+ if (isRainbow()) {
423
+ const ring = rainbowRoll().ring
424
+ return ring[((index % ring.length) + ring.length) % ring.length]
425
+ }
426
+ return base
427
+ }
428
+
181
429
  /** Paint with the primary brand blue: whale, wordmark, tool names, accents. */
182
430
  export function brand(text: string): string {
183
431
  return chalk.rgb(...activePalette.brand)(text)