Swadhin Biswas feat: implement mervelas cli engine, built-in tools, and reactive UI · 4/3/2026
0358986
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
import chalk, { Chalk } from 'chalk'
import { env } from './env.js'
export type Theme = {
autoAccept: string
bashBorder: string
claude: string
claudeShimmer: string // Lighter version of claude color for shimmer effect
claudeBlue_FOR_SYSTEM_SPINNER: string
claudeBlueShimmer_FOR_SYSTEM_SPINNER: string
permission: string
permissionShimmer: string // Lighter version of permission color for shimmer effect
planMode: string
ide: string
promptBorder: string
promptBorderShimmer: string // Lighter version of promptBorder color for shimmer effect
text: string
inverseText: string
inactive: string
inactiveShimmer: string // Lighter version of inactive color for shimmer effect
subtle: string
suggestion: string
remember: string
background: string
// Semantic colors
success: string
error: string
warning: string
merged: string
warningShimmer: string // Lighter version of warning color for shimmer effect
// Diff colors
diffAdded: string
diffRemoved: string
diffAddedDimmed: string
diffRemovedDimmed: string
// Word-level diff highlighting
diffAddedWord: string
diffRemovedWord: string
// Agent colors
red_FOR_SUBAGENTS_ONLY: string
blue_FOR_SUBAGENTS_ONLY: string
green_FOR_SUBAGENTS_ONLY: string
yellow_FOR_SUBAGENTS_ONLY: string
purple_FOR_SUBAGENTS_ONLY: string
orange_FOR_SUBAGENTS_ONLY: string
pink_FOR_SUBAGENTS_ONLY: string
cyan_FOR_SUBAGENTS_ONLY: string
// Grove colors
professionalBlue: string
// Chrome colors
chromeYellow: string
// TUI V2 colors
clawd_body: string
clawd_background: string
userMessageBackground: string
userMessageBackgroundHover: string
/** Message-actions selection. Cool shift toward `suggestion` blue; distinct from default AND userMessageBackground. */
messageActionsBackground: string
/** Text-selection highlight background (alt-screen mouse selection). Solid
* bg that REPLACES the cell's bg while preserving its fg — matches native
* terminal selection. Previously SGR-7 inverse (swapped fg/bg per cell),
* which fragmented badly over syntax highlighting. */
selectionBg: string
bashMessageBackgroundColor: string
memoryBackgroundColor: string
rate_limit_fill: string
rate_limit_empty: string
fastMode: string
fastModeShimmer: string
// Brief/assistant mode label colors
briefLabelYou: string
briefLabelClaude: string
// Rainbow colors for ultrathink keyword highlighting
rainbow_red: string
rainbow_orange: string
rainbow_yellow: string
rainbow_green: string
rainbow_blue: string
rainbow_indigo: string
rainbow_violet: string
rainbow_red_shimmer: string
rainbow_orange_shimmer: string
rainbow_yellow_shimmer: string
rainbow_green_shimmer: string
rainbow_blue_shimmer: string
rainbow_indigo_shimmer: string
rainbow_violet_shimmer: string
}
export const THEME_NAMES = [
'dark',
'light',
'light-daltonized',
'dark-daltonized',
'light-ansi',
'dark-ansi',
] as const
/** A renderable theme. Always resolvable to a concrete color palette. */
export type ThemeName = (typeof THEME_NAMES)[number]
export const THEME_SETTINGS = ['auto', ...THEME_NAMES] as const
/**
* A theme preference as stored in user config. `'auto'` follows the system
* dark/light mode and is resolved to a ThemeName at runtime.
*/
export type ThemeSetting = (typeof THEME_SETTINGS)[number]
/**
* Light theme using explicit RGB values to avoid inconsistencies
* from users' custom terminal ANSI color definitions
*/
const lightTheme: Theme = {
autoAccept: 'rgb(135,0,255)', // Electric violet
bashBorder: 'rgb(255,0,135)', // Vibrant pink
claude: 'rgb(59,130,246)', // Mervelas blue
claudeShimmer: 'rgb(96,165,250)', // Lighter blue shimmer
claudeBlue_FOR_SYSTEM_SPINNER: 'rgb(87,105,247)', // Medium blue for system spinner
claudeBlueShimmer_FOR_SYSTEM_SPINNER: 'rgb(117,135,255)', // Lighter blue for system spinner shimmer
permission: 'rgb(87,105,247)', // Medium blue
permissionShimmer: 'rgb(137,155,255)', // Lighter blue for shimmer effect
planMode: 'rgb(0,102,102)', // Muted teal
ide: 'rgb(71,130,200)', // Muted blue
promptBorder: 'rgb(153,153,153)', // Medium gray
promptBorderShimmer: 'rgb(183,183,183)', // Lighter gray for shimmer effect
text: 'rgb(0,0,0)', // Black
inverseText: 'rgb(255,255,255)', // White
inactive: 'rgb(102,102,102)', // Dark gray
inactiveShimmer: 'rgb(142,142,142)', // Lighter gray for shimmer effect
subtle: 'rgb(175,175,175)', // Light gray
suggestion: 'rgb(87,105,247)', // Medium blue
remember: 'rgb(0,0,255)', // Blue
background: 'rgb(0,153,153)', // Cyan
success: 'rgb(44,122,57)', // Green
error: 'rgb(171,43,63)', // Red
warning: 'rgb(150,108,30)', // Amber
merged: 'rgb(135,0,255)', // Electric violet (matches autoAccept)
warningShimmer: 'rgb(200,158,80)', // Lighter amber for shimmer effect
diffAdded: 'rgb(105,219,124)', // Light green
diffRemoved: 'rgb(255,168,180)', // Light red
diffAddedDimmed: 'rgb(199,225,203)', // Very light green
diffRemovedDimmed: 'rgb(253,210,216)', // Very light red
diffAddedWord: 'rgb(47,157,68)', // Medium green
diffRemovedWord: 'rgb(209,69,75)', // Medium red
// Agent colors
red_FOR_SUBAGENTS_ONLY: 'rgb(220,38,38)', // Red 600
blue_FOR_SUBAGENTS_ONLY: 'rgb(37,99,235)', // Blue 600
green_FOR_SUBAGENTS_ONLY: 'rgb(22,163,74)', // Green 600
yellow_FOR_SUBAGENTS_ONLY: 'rgb(202,138,4)', // Yellow 600
purple_FOR_SUBAGENTS_ONLY: 'rgb(147,51,234)', // Purple 600
orange_FOR_SUBAGENTS_ONLY: 'rgb(234,88,12)', // Orange 600
pink_FOR_SUBAGENTS_ONLY: 'rgb(219,39,119)', // Pink 600
cyan_FOR_SUBAGENTS_ONLY: 'rgb(8,145,178)', // Cyan 600
// Grove colors
professionalBlue: 'rgb(106,155,204)',
// Chrome colors
chromeYellow: 'rgb(251,188,4)', // Chrome yellow
// TUI V2 colors
clawd_body: 'rgb(59,130,246)',
clawd_background: 'rgb(0,0,0)',
userMessageBackground: 'rgb(240, 240, 240)', // Slightly darker grey for optimal contrast
userMessageBackgroundHover: 'rgb(252, 252, 252)', // ≥250 to quantize distinct from base at 256-color level
messageActionsBackground: 'rgb(232, 236, 244)', // cool gray — darker than userMsg 240 (visible on white), slight blue toward `suggestion`
selectionBg: 'rgb(180, 213, 255)', // classic light-mode selection blue (macOS/VS Code-ish); dark fgs stay readable
bashMessageBackgroundColor: 'rgb(250, 245, 250)',
memoryBackgroundColor: 'rgb(230, 245, 250)',
rate_limit_fill: 'rgb(87,105,247)', // Medium blue
rate_limit_empty: 'rgb(39,47,111)', // Dark blue
fastMode: 'rgb(37,99,235)', // Electric blue
fastModeShimmer: 'rgb(96,165,250)', // Lighter blue shimmer
// Brief/assistant mode
briefLabelYou: 'rgb(37,99,235)', // Blue
briefLabelClaude: 'rgb(59,130,246)', // Brand blue
rainbow_red: 'rgb(235,95,87)',
rainbow_orange: 'rgb(245,139,87)',
rainbow_yellow: 'rgb(250,195,95)',
rainbow_green: 'rgb(145,200,130)',
rainbow_blue: 'rgb(130,170,220)',
rainbow_indigo: 'rgb(155,130,200)',
rainbow_violet: 'rgb(200,130,180)',
rainbow_red_shimmer: 'rgb(250,155,147)',
rainbow_orange_shimmer: 'rgb(255,185,137)',
rainbow_yellow_shimmer: 'rgb(255,225,155)',
rainbow_green_shimmer: 'rgb(185,230,180)',
rainbow_blue_shimmer: 'rgb(180,205,240)',
rainbow_indigo_shimmer: 'rgb(195,180,230)',
rainbow_violet_shimmer: 'rgb(230,180,210)',
}
/**
* Light ANSI theme using only the 16 standard ANSI colors
* for terminals without true color support
*/
const lightAnsiTheme: Theme = {
autoAccept: 'ansi:magenta',
bashBorder: 'ansi:magenta',
claude: 'ansi:blueBright',
claudeShimmer: 'ansi:cyanBright',
claudeBlue_FOR_SYSTEM_SPINNER: 'ansi:blue',
claudeBlueShimmer_FOR_SYSTEM_SPINNER: 'ansi:blueBright',
permission: 'ansi:blue',
permissionShimmer: 'ansi:blueBright',
planMode: 'ansi:cyan',
ide: 'ansi:blueBright',
promptBorder: 'ansi:white',
promptBorderShimmer: 'ansi:whiteBright',
text: 'ansi:black',
inverseText: 'ansi:white',
inactive: 'ansi:blackBright',
inactiveShimmer: 'ansi:white',
subtle: 'ansi:blackBright',
suggestion: 'ansi:blue',
remember: 'ansi:blue',
background: 'ansi:cyan',
success: 'ansi:green',
error: 'ansi:red',
warning: 'ansi:yellow',
merged: 'ansi:magenta',
warningShimmer: 'ansi:yellowBright',
diffAdded: 'ansi:green',
diffRemoved: 'ansi:red',
diffAddedDimmed: 'ansi:green',
diffRemovedDimmed: 'ansi:red',
diffAddedWord: 'ansi:greenBright',
diffRemovedWord: 'ansi:redBright',
// Agent colors
red_FOR_SUBAGENTS_ONLY: 'ansi:red',
blue_FOR_SUBAGENTS_ONLY: 'ansi:blue',
green_FOR_SUBAGENTS_ONLY: 'ansi:green',
yellow_FOR_SUBAGENTS_ONLY: 'ansi:yellow',
purple_FOR_SUBAGENTS_ONLY: 'ansi:magenta',
orange_FOR_SUBAGENTS_ONLY: 'ansi:redBright',
pink_FOR_SUBAGENTS_ONLY: 'ansi:magentaBright',
cyan_FOR_SUBAGENTS_ONLY: 'ansi:cyan',
// Grove colors
professionalBlue: 'ansi:blueBright',
// Chrome colors
chromeYellow: 'ansi:yellow', // Chrome yellow
// TUI V2 colors
clawd_body: 'ansi:blueBright',
clawd_background: 'ansi:black',
userMessageBackground: 'ansi:white',
userMessageBackgroundHover: 'ansi:whiteBright',
messageActionsBackground: 'ansi:white',
selectionBg: 'ansi:cyan', // lighter named bg for light-ansi; dark fgs stay readable
bashMessageBackgroundColor: 'ansi:whiteBright',
memoryBackgroundColor: 'ansi:white',
rate_limit_fill: 'ansi:yellow',
rate_limit_empty: 'ansi:black',
fastMode: 'ansi:blue',
fastModeShimmer: 'ansi:blueBright',
briefLabelYou: 'ansi:blue',
briefLabelClaude: 'ansi:blueBright',
rainbow_red: 'ansi:red',
rainbow_orange: 'ansi:redBright',
rainbow_yellow: 'ansi:yellow',
rainbow_green: 'ansi:green',
rainbow_blue: 'ansi:cyan',
rainbow_indigo: 'ansi:blue',
rainbow_violet: 'ansi:magenta',
rainbow_red_shimmer: 'ansi:redBright',
rainbow_orange_shimmer: 'ansi:yellow',
rainbow_yellow_shimmer: 'ansi:yellowBright',
rainbow_green_shimmer: 'ansi:greenBright',
rainbow_blue_shimmer: 'ansi:cyanBright',
rainbow_indigo_shimmer: 'ansi:blueBright',
rainbow_violet_shimmer: 'ansi:magentaBright',
}
/**
* Dark ANSI theme using only the 16 standard ANSI colors
* for terminals without true color support
*/
const darkAnsiTheme: Theme = {
autoAccept: 'ansi:magentaBright',
bashBorder: 'ansi:magentaBright',
claude: 'ansi:blueBright',
claudeShimmer: 'ansi:cyanBright',
claudeBlue_FOR_SYSTEM_SPINNER: 'ansi:blueBright',
claudeBlueShimmer_FOR_SYSTEM_SPINNER: 'ansi:blueBright',
permission: 'ansi:blueBright',
permissionShimmer: 'ansi:blueBright',
planMode: 'ansi:cyanBright',
ide: 'ansi:blue',
promptBorder: 'ansi:white',
promptBorderShimmer: 'ansi:whiteBright',
text: 'ansi:whiteBright',
inverseText: 'ansi:black',
inactive: 'ansi:white',
inactiveShimmer: 'ansi:whiteBright',
subtle: 'ansi:white',
suggestion: 'ansi:blueBright',
remember: 'ansi:blueBright',
background: 'ansi:cyanBright',
success: 'ansi:greenBright',
error: 'ansi:redBright',
warning: 'ansi:yellowBright',
merged: 'ansi:magentaBright',
warningShimmer: 'ansi:yellowBright',
diffAdded: 'ansi:green',
diffRemoved: 'ansi:red',
diffAddedDimmed: 'ansi:green',
diffRemovedDimmed: 'ansi:red',
diffAddedWord: 'ansi:greenBright',
diffRemovedWord: 'ansi:redBright',
// Agent colors
red_FOR_SUBAGENTS_ONLY: 'ansi:redBright',
blue_FOR_SUBAGENTS_ONLY: 'ansi:blueBright',
green_FOR_SUBAGENTS_ONLY: 'ansi:greenBright',
yellow_FOR_SUBAGENTS_ONLY: 'ansi:yellowBright',
purple_FOR_SUBAGENTS_ONLY: 'ansi:magentaBright',
orange_FOR_SUBAGENTS_ONLY: 'ansi:redBright',
pink_FOR_SUBAGENTS_ONLY: 'ansi:magentaBright',
cyan_FOR_SUBAGENTS_ONLY: 'ansi:cyanBright',
// Grove colors
professionalBlue: 'rgb(106,155,204)',
// Chrome colors
chromeYellow: 'ansi:yellowBright', // Chrome yellow
// TUI V2 colors
clawd_body: 'ansi:blueBright',
clawd_background: 'ansi:black',
userMessageBackground: 'ansi:blackBright',
userMessageBackgroundHover: 'ansi:white',
messageActionsBackground: 'ansi:blackBright',
selectionBg: 'ansi:blue', // darker named bg for dark-ansi; bright fgs stay readable
bashMessageBackgroundColor: 'ansi:black',
memoryBackgroundColor: 'ansi:blackBright',
rate_limit_fill: 'ansi:yellow',
rate_limit_empty: 'ansi:white',
fastMode: 'ansi:blueBright',
fastModeShimmer: 'ansi:cyanBright',
briefLabelYou: 'ansi:blueBright',
briefLabelClaude: 'ansi:blueBright',
rainbow_red: 'ansi:red',
rainbow_orange: 'ansi:redBright',
rainbow_yellow: 'ansi:yellow',
rainbow_green: 'ansi:green',
rainbow_blue: 'ansi:cyan',
rainbow_indigo: 'ansi:blue',
rainbow_violet: 'ansi:magenta',
rainbow_red_shimmer: 'ansi:redBright',
rainbow_orange_shimmer: 'ansi:yellow',
rainbow_yellow_shimmer: 'ansi:yellowBright',
rainbow_green_shimmer: 'ansi:greenBright',
rainbow_blue_shimmer: 'ansi:cyanBright',
rainbow_indigo_shimmer: 'ansi:blueBright',
rainbow_violet_shimmer: 'ansi:magentaBright',
}
/**
* Light daltonized theme (color-blind friendly) using explicit RGB values
* to avoid inconsistencies from users' custom terminal ANSI color definitions
*/
const lightDaltonizedTheme: Theme = {
autoAccept: 'rgb(135,0,255)', // Electric violet
bashBorder: 'rgb(0,102,204)', // Blue instead of pink
claude: 'rgb(51,102,255)', // Mervelas blue for deuteranopia
claudeShimmer: 'rgb(101,152,255)', // Lighter blue shimmer
claudeBlue_FOR_SYSTEM_SPINNER: 'rgb(51,102,255)', // Bright blue for system spinner
claudeBlueShimmer_FOR_SYSTEM_SPINNER: 'rgb(101,152,255)', // Lighter bright blue for system spinner shimmer
permission: 'rgb(51,102,255)', // Bright blue
permissionShimmer: 'rgb(101,152,255)', // Lighter bright blue for shimmer
planMode: 'rgb(51,102,102)', // Muted blue-gray (works for color-blind)
ide: 'rgb(71,130,200)', // Muted blue
promptBorder: 'rgb(153,153,153)', // Medium gray
promptBorderShimmer: 'rgb(183,183,183)', // Lighter gray for shimmer
text: 'rgb(0,0,0)', // Black
inverseText: 'rgb(255,255,255)', // White
inactive: 'rgb(102,102,102)', // Dark gray
inactiveShimmer: 'rgb(142,142,142)', // Lighter gray for shimmer effect
subtle: 'rgb(175,175,175)', // Light gray
suggestion: 'rgb(51,102,255)', // Bright blue
remember: 'rgb(51,102,255)', // Bright blue
background: 'rgb(0,153,153)', // Cyan (color-blind friendly)
success: 'rgb(0,102,153)', // Blue instead of green for deuteranopia
error: 'rgb(204,0,0)', // Pure red for better distinction
warning: 'rgb(255,153,0)', // Orange adjusted for deuteranopia
merged: 'rgb(135,0,255)', // Electric violet (matches autoAccept)
warningShimmer: 'rgb(255,183,50)', // Lighter orange for shimmer
diffAdded: 'rgb(153,204,255)', // Light blue instead of green
diffRemoved: 'rgb(255,204,204)', // Light red
diffAddedDimmed: 'rgb(209,231,253)', // Very light blue
diffRemovedDimmed: 'rgb(255,233,233)', // Very light red
diffAddedWord: 'rgb(51,102,204)', // Medium blue (less intense than deep blue)
diffRemovedWord: 'rgb(153,51,51)', // Softer red (less intense than deep red)
// Agent colors (daltonism-friendly)
red_FOR_SUBAGENTS_ONLY: 'rgb(204,0,0)', // Pure red
blue_FOR_SUBAGENTS_ONLY: 'rgb(0,102,204)', // Pure blue
green_FOR_SUBAGENTS_ONLY: 'rgb(0,204,0)', // Pure green
yellow_FOR_SUBAGENTS_ONLY: 'rgb(255,204,0)', // Golden yellow
purple_FOR_SUBAGENTS_ONLY: 'rgb(128,0,128)', // True purple
orange_FOR_SUBAGENTS_ONLY: 'rgb(255,128,0)', // True orange
pink_FOR_SUBAGENTS_ONLY: 'rgb(255,102,178)', // Adjusted pink
cyan_FOR_SUBAGENTS_ONLY: 'rgb(0,178,178)', // Adjusted cyan
// Grove colors
professionalBlue: 'rgb(106,155,204)',
// Chrome colors
chromeYellow: 'rgb(251,188,4)', // Chrome yellow
// TUI V2 colors
clawd_body: 'rgb(51,102,255)',
clawd_background: 'rgb(0,0,0)',
userMessageBackground: 'rgb(220, 220, 220)', // Slightly darker grey for optimal contrast
userMessageBackgroundHover: 'rgb(232, 232, 232)', // ≥230 to quantize distinct from base at 256-color level
messageActionsBackground: 'rgb(210, 216, 226)', // cool gray — darker than userMsg 220, slight blue
selectionBg: 'rgb(180, 213, 255)', // light selection blue; daltonized fgs are yellows/blues, both readable on light blue
bashMessageBackgroundColor: 'rgb(250, 245, 250)',
memoryBackgroundColor: 'rgb(230, 245, 250)',
rate_limit_fill: 'rgb(51,102,255)', // Bright blue
rate_limit_empty: 'rgb(23,46,114)', // Dark blue
fastMode: 'rgb(0,102,204)', // Electric blue
fastModeShimmer: 'rgb(101,152,255)', // Lighter blue shimmer
briefLabelYou: 'rgb(37,99,235)', // Blue
briefLabelClaude: 'rgb(51,102,255)', // Brand blue
rainbow_red: 'rgb(235,95,87)',
rainbow_orange: 'rgb(245,139,87)',
rainbow_yellow: 'rgb(250,195,95)',
rainbow_green: 'rgb(145,200,130)',
rainbow_blue: 'rgb(130,170,220)',
rainbow_indigo: 'rgb(155,130,200)',
rainbow_violet: 'rgb(200,130,180)',
rainbow_red_shimmer: 'rgb(250,155,147)',
rainbow_orange_shimmer: 'rgb(255,185,137)',
rainbow_yellow_shimmer: 'rgb(255,225,155)',
rainbow_green_shimmer: 'rgb(185,230,180)',
rainbow_blue_shimmer: 'rgb(180,205,240)',
rainbow_indigo_shimmer: 'rgb(195,180,230)',
rainbow_violet_shimmer: 'rgb(230,180,210)',
}
/**
* Dark theme using explicit RGB values to avoid inconsistencies
* from users' custom terminal ANSI color definitions
*/
const darkTheme: Theme = {
autoAccept: 'rgb(175,135,255)', // Electric violet
bashBorder: 'rgb(253,93,177)', // Bright pink
claude: 'rgb(96,165,250)', // Mervelas blue
claudeShimmer: 'rgb(147,197,253)', // Lighter blue shimmer
claudeBlue_FOR_SYSTEM_SPINNER: 'rgb(147,165,255)', // Blue for system spinner
claudeBlueShimmer_FOR_SYSTEM_SPINNER: 'rgb(177,195,255)', // Lighter blue for system spinner shimmer
permission: 'rgb(177,185,249)', // Light blue-purple
permissionShimmer: 'rgb(207,215,255)', // Lighter blue-purple for shimmer
planMode: 'rgb(72,150,140)', // Muted sage green
ide: 'rgb(71,130,200)', // Muted blue
promptBorder: 'rgb(136,136,136)', // Medium gray
promptBorderShimmer: 'rgb(166,166,166)', // Lighter gray for shimmer
text: 'rgb(255,255,255)', // White
inverseText: 'rgb(0,0,0)', // Black
inactive: 'rgb(153,153,153)', // Light gray
inactiveShimmer: 'rgb(193,193,193)', // Lighter gray for shimmer effect
subtle: 'rgb(80,80,80)', // Dark gray
suggestion: 'rgb(177,185,249)', // Light blue-purple
remember: 'rgb(177,185,249)', // Light blue-purple
background: 'rgb(0,204,204)', // Bright cyan
success: 'rgb(78,186,101)', // Bright green
error: 'rgb(255,107,128)', // Bright red
warning: 'rgb(255,193,7)', // Bright amber
merged: 'rgb(175,135,255)', // Electric violet (matches autoAccept)
warningShimmer: 'rgb(255,223,57)', // Lighter amber for shimmer
diffAdded: 'rgb(34,92,43)', // Dark green
diffRemoved: 'rgb(122,41,54)', // Dark red
diffAddedDimmed: 'rgb(71,88,74)', // Very dark green
diffRemovedDimmed: 'rgb(105,72,77)', // Very dark red
diffAddedWord: 'rgb(56,166,96)', // Medium green
diffRemovedWord: 'rgb(179,89,107)', // Softer red (less intense than bright red)
// Agent colors
red_FOR_SUBAGENTS_ONLY: 'rgb(220,38,38)', // Red 600
blue_FOR_SUBAGENTS_ONLY: 'rgb(37,99,235)', // Blue 600
green_FOR_SUBAGENTS_ONLY: 'rgb(22,163,74)', // Green 600
yellow_FOR_SUBAGENTS_ONLY: 'rgb(202,138,4)', // Yellow 600
purple_FOR_SUBAGENTS_ONLY: 'rgb(147,51,234)', // Purple 600
orange_FOR_SUBAGENTS_ONLY: 'rgb(234,88,12)', // Orange 600
pink_FOR_SUBAGENTS_ONLY: 'rgb(219,39,119)', // Pink 600
cyan_FOR_SUBAGENTS_ONLY: 'rgb(8,145,178)', // Cyan 600
// Grove colors
professionalBlue: 'rgb(106,155,204)',
// Chrome colors
chromeYellow: 'rgb(251,188,4)', // Chrome yellow
// TUI V2 colors
clawd_body: 'rgb(96,165,250)',
clawd_background: 'rgb(0,0,0)',
userMessageBackground: 'rgb(55, 55, 55)', // Lighter grey for better visual contrast
userMessageBackgroundHover: 'rgb(70, 70, 70)',
messageActionsBackground: 'rgb(44, 50, 62)', // cool gray, slight blue
selectionBg: 'rgb(38, 79, 120)', // classic dark-mode selection blue (VS Code dark default); light fgs stay readable
bashMessageBackgroundColor: 'rgb(65, 60, 65)',
memoryBackgroundColor: 'rgb(55, 65, 70)',
rate_limit_fill: 'rgb(177,185,249)', // Light blue-purple
rate_limit_empty: 'rgb(80,83,112)', // Medium blue-purple
fastMode: 'rgb(59,130,246)', // Electric blue for dark bg
fastModeShimmer: 'rgb(96,165,250)', // Lighter blue shimmer
briefLabelYou: 'rgb(122,180,232)', // Light blue
briefLabelClaude: 'rgb(96,165,250)', // Brand blue
rainbow_red: 'rgb(235,95,87)',
rainbow_orange: 'rgb(245,139,87)',
rainbow_yellow: 'rgb(250,195,95)',
rainbow_green: 'rgb(145,200,130)',
rainbow_blue: 'rgb(130,170,220)',
rainbow_indigo: 'rgb(155,130,200)',
rainbow_violet: 'rgb(200,130,180)',
rainbow_red_shimmer: 'rgb(250,155,147)',
rainbow_orange_shimmer: 'rgb(255,185,137)',
rainbow_yellow_shimmer: 'rgb(255,225,155)',
rainbow_green_shimmer: 'rgb(185,230,180)',
rainbow_blue_shimmer: 'rgb(180,205,240)',
rainbow_indigo_shimmer: 'rgb(195,180,230)',
rainbow_violet_shimmer: 'rgb(230,180,210)',
}
/**
* Dark daltonized theme (color-blind friendly) using explicit RGB values
* to avoid inconsistencies from users' custom terminal ANSI color definitions
*/
const darkDaltonizedTheme: Theme = {
autoAccept: 'rgb(175,135,255)', // Electric violet
bashBorder: 'rgb(51,153,255)', // Bright blue
claude: 'rgb(153,204,255)', // Mervelas blue for deuteranopia
claudeShimmer: 'rgb(183,224,255)', // Lighter blue shimmer
claudeBlue_FOR_SYSTEM_SPINNER: 'rgb(153,204,255)', // Light blue for system spinner
claudeBlueShimmer_FOR_SYSTEM_SPINNER: 'rgb(183,224,255)', // Lighter blue for system spinner shimmer
permission: 'rgb(153,204,255)', // Light blue
permissionShimmer: 'rgb(183,224,255)', // Lighter blue for shimmer
planMode: 'rgb(102,153,153)', // Muted gray-teal (works for color-blind)
ide: 'rgb(71,130,200)', // Muted blue
promptBorder: 'rgb(136,136,136)', // Medium gray
promptBorderShimmer: 'rgb(166,166,166)', // Lighter gray for shimmer
text: 'rgb(255,255,255)', // White
inverseText: 'rgb(0,0,0)', // Black
inactive: 'rgb(153,153,153)', // Light gray
inactiveShimmer: 'rgb(193,193,193)', // Lighter gray for shimmer effect
subtle: 'rgb(80,80,80)', // Dark gray
suggestion: 'rgb(153,204,255)', // Light blue
remember: 'rgb(153,204,255)', // Light blue
background: 'rgb(0,204,204)', // Bright cyan (color-blind friendly)
success: 'rgb(51,153,255)', // Blue instead of green
error: 'rgb(255,102,102)', // Bright red
warning: 'rgb(255,204,0)', // Yellow-orange for deuteranopia
merged: 'rgb(175,135,255)', // Electric violet (matches autoAccept)
warningShimmer: 'rgb(255,234,50)', // Lighter yellow-orange for shimmer
diffAdded: 'rgb(0,68,102)', // Dark blue
diffRemoved: 'rgb(102,0,0)', // Dark red
diffAddedDimmed: 'rgb(62,81,91)', // Dimmed blue
diffRemovedDimmed: 'rgb(62,44,44)', // Dimmed red
diffAddedWord: 'rgb(0,119,179)', // Medium blue
diffRemovedWord: 'rgb(179,0,0)', // Medium red
// Agent colors (daltonism-friendly, dark mode)
red_FOR_SUBAGENTS_ONLY: 'rgb(255,102,102)', // Bright red
blue_FOR_SUBAGENTS_ONLY: 'rgb(102,178,255)', // Bright blue
green_FOR_SUBAGENTS_ONLY: 'rgb(102,255,102)', // Bright green
yellow_FOR_SUBAGENTS_ONLY: 'rgb(255,255,102)', // Bright yellow
purple_FOR_SUBAGENTS_ONLY: 'rgb(178,102,255)', // Bright purple
orange_FOR_SUBAGENTS_ONLY: 'rgb(255,178,102)', // Bright orange
pink_FOR_SUBAGENTS_ONLY: 'rgb(255,153,204)', // Bright pink
cyan_FOR_SUBAGENTS_ONLY: 'rgb(102,204,204)', // Bright cyan
// Grove colors
professionalBlue: 'rgb(106,155,204)',
// Chrome colors
chromeYellow: 'rgb(251,188,4)', // Chrome yellow
// TUI V2 colors
clawd_body: 'rgb(153,204,255)',
clawd_background: 'rgb(0,0,0)',
userMessageBackground: 'rgb(55, 55, 55)', // Lighter grey for better visual contrast
userMessageBackgroundHover: 'rgb(70, 70, 70)',
messageActionsBackground: 'rgb(44, 50, 62)', // cool gray, slight blue
selectionBg: 'rgb(38, 79, 120)', // classic dark-mode selection blue (VS Code dark default); light fgs stay readable
bashMessageBackgroundColor: 'rgb(65, 60, 65)',
memoryBackgroundColor: 'rgb(55, 65, 70)',
rate_limit_fill: 'rgb(153,204,255)', // Light blue
rate_limit_empty: 'rgb(69,92,115)', // Dark blue
fastMode: 'rgb(102,178,255)', // Electric blue for dark bg
fastModeShimmer: 'rgb(183,224,255)', // Lighter blue shimmer
briefLabelYou: 'rgb(122,180,232)', // Light blue
briefLabelClaude: 'rgb(153,204,255)', // Brand blue
rainbow_red: 'rgb(235,95,87)',
rainbow_orange: 'rgb(245,139,87)',
rainbow_yellow: 'rgb(250,195,95)',
rainbow_green: 'rgb(145,200,130)',
rainbow_blue: 'rgb(130,170,220)',
rainbow_indigo: 'rgb(155,130,200)',
rainbow_violet: 'rgb(200,130,180)',
rainbow_red_shimmer: 'rgb(250,155,147)',
rainbow_orange_shimmer: 'rgb(255,185,137)',
rainbow_yellow_shimmer: 'rgb(255,225,155)',
rainbow_green_shimmer: 'rgb(185,230,180)',
rainbow_blue_shimmer: 'rgb(180,205,240)',
rainbow_indigo_shimmer: 'rgb(195,180,230)',
rainbow_violet_shimmer: 'rgb(230,180,210)',
}
export function getTheme(themeName: ThemeName): Theme {
switch (themeName) {
case 'light':
return lightTheme
case 'light-ansi':
return lightAnsiTheme
case 'dark-ansi':
return darkAnsiTheme
case 'light-daltonized':
return lightDaltonizedTheme
case 'dark-daltonized':
return darkDaltonizedTheme
default:
return darkTheme
}
}
// Create a chalk instance with 256-color level for Apple Terminal
// Apple Terminal doesn't handle 24-bit color escape sequences well
const chalkForChart =
env.terminal === 'Apple_Terminal'
? new Chalk({ level: 2 }) // 256 colors
: chalk
/**
* Converts a theme color to an ANSI escape sequence for use with asciichart.
* Uses chalk to generate the escape codes, with 256-color mode for Apple Terminal.
*/
export function themeColorToAnsi(themeColor: string): string {
const rgbMatch = themeColor.match(/rgb\(\s?(\d+),\s?(\d+),\s?(\d+)\s?\)/)
if (rgbMatch) {
const r = parseInt(rgbMatch[1]!, 10)
const g = parseInt(rgbMatch[2]!, 10)
const b = parseInt(rgbMatch[3]!, 10)
// Use chalk.rgb which auto-converts to 256 colors when level is 2
// Extract just the opening escape sequence by using a marker
const colored = chalkForChart.rgb(r, g, b)('X')
return colored.slice(0, colored.indexOf('X'))
}
// Fallback to magenta if parsing fails
return '\x1b[35m'
}