@agi-fans/dsh-tui 0.4.0 → 0.5.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/README.md +43 -7
- package/lib/CHANGELOG.md +40 -1
- package/lib/{box.d.ts → chrome/box.d.ts} +2 -0
- package/lib/{box.js → chrome/box.js} +26 -16
- package/lib/chrome/box.js.map +1 -0
- package/lib/chrome/command-output.js.map +1 -0
- package/lib/chrome/diff-render.d.ts +39 -0
- package/lib/chrome/diff-render.js +274 -0
- package/lib/chrome/diff-render.js.map +1 -0
- package/lib/chrome/markdown.d.ts +17 -0
- package/lib/chrome/markdown.js +537 -0
- package/lib/chrome/markdown.js.map +1 -0
- package/lib/chrome/path-mentions.js.map +1 -0
- package/lib/chrome/relative-time.js.map +1 -0
- package/lib/chrome/renderer.js.map +1 -0
- package/lib/chrome/status-config.d.ts +70 -0
- package/lib/chrome/status-config.js +147 -0
- package/lib/chrome/status-config.js.map +1 -0
- package/lib/{status-line.d.ts → chrome/status-line.d.ts} +20 -2
- package/lib/{status-line.js → chrome/status-line.js} +175 -113
- package/lib/chrome/status-line.js.map +1 -0
- package/lib/chrome/style.js.map +1 -0
- package/lib/{theme.d.ts → chrome/theme.d.ts} +5 -3
- package/lib/chrome/theme.js +708 -0
- package/lib/chrome/theme.js.map +1 -0
- package/lib/{tool-renderers.js → chrome/tool-renderers.js} +25 -20
- package/lib/chrome/tool-renderers.js.map +1 -0
- package/lib/chrome/tools-list.js.map +1 -0
- package/lib/{welcome-tips.js → chrome/welcome-tips.js} +4 -2
- package/lib/chrome/welcome-tips.js.map +1 -0
- package/lib/chrome/width.js.map +1 -0
- package/lib/{command-auth.js → commands/auth.js} +2 -2
- package/lib/commands/auth.js.map +1 -0
- package/lib/{command-export.js → commands/export.js} +3 -3
- package/lib/commands/export.js.map +1 -0
- package/lib/{command-integrations.js → commands/integrations.js} +2 -2
- package/lib/commands/integrations.js.map +1 -0
- package/lib/{command-loop.d.ts → commands/loop.d.ts} +1 -1
- package/lib/{command-loop.js → commands/loop.js} +2 -2
- package/lib/commands/loop.js.map +1 -0
- package/lib/{command-model.js → commands/model.js} +2 -2
- package/lib/commands/model.js.map +1 -0
- package/lib/{command-permission.js → commands/permission.js} +13 -8
- package/lib/commands/permission.js.map +1 -0
- package/lib/{command-registration.js → commands/registration.js} +1 -1
- package/lib/commands/registration.js.map +1 -0
- package/lib/commands/session-configuration.d.ts +5 -0
- package/lib/commands/session-configuration.js +108 -0
- package/lib/commands/session-configuration.js.map +1 -0
- package/lib/{command-session.js → commands/session.js} +10 -7
- package/lib/commands/session.js.map +1 -0
- package/lib/{command-steer.js → commands/steer.js} +2 -2
- package/lib/commands/steer.js.map +1 -0
- package/lib/definition.d.ts +6 -1
- package/lib/definition.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/input/clipboard.js.map +1 -0
- package/lib/input/editor.js.map +1 -0
- package/lib/input/external-editor.js.map +1 -0
- package/lib/{image-paste.d.ts → input/image-paste.d.ts} +1 -1
- package/lib/input/image-paste.js.map +1 -0
- package/lib/input/keybindings-config.js.map +1 -0
- package/lib/input/keys.js.map +1 -0
- package/lib/runtime/agent-profile.d.ts +10 -0
- package/lib/runtime/agent-profile.js +9 -0
- package/lib/runtime/agent-profile.js.map +1 -0
- package/lib/{human-interaction.js → runtime/human-interaction.js} +1 -1
- package/lib/runtime/human-interaction.js.map +1 -0
- package/lib/{provider-local.d.ts → runtime/provider-local.d.ts} +9 -9
- package/lib/{provider-local.js → runtime/provider-local.js} +30 -26
- package/lib/runtime/provider-local.js.map +1 -0
- package/lib/runtime/runner.js.map +1 -0
- package/lib/{session-runtime.d.ts → runtime/session-runtime.d.ts} +2 -2
- package/lib/{session-runtime.js → runtime/session-runtime.js} +3 -3
- package/lib/runtime/session-runtime.js.map +1 -0
- package/lib/{startup-notices.js → runtime/startup-notices.js} +6 -6
- package/lib/runtime/startup-notices.js.map +1 -0
- package/lib/{tool-presentation.d.ts → runtime/tool-presentation.d.ts} +1 -1
- package/lib/runtime/tool-presentation.js.map +1 -0
- package/lib/{interaction-adapter.d.ts → session/interaction-adapter.d.ts} +1 -1
- package/lib/session/interaction-adapter.js.map +1 -0
- package/lib/{package-metadata.js → session/package-metadata.js} +1 -1
- package/lib/session/package-metadata.js.map +1 -0
- package/lib/session/project-context.js.map +1 -0
- package/lib/session/project-file-search.js.map +1 -0
- package/lib/session/release-notes.js.map +1 -0
- package/lib/session/session-configuration.d.ts +25 -0
- package/lib/session/session-configuration.js +56 -0
- package/lib/session/session-configuration.js.map +1 -0
- package/lib/{session-controller.d.ts → session/session-controller.d.ts} +13 -2
- package/lib/{session-controller.js → session/session-controller.js} +181 -11
- package/lib/session/session-controller.js.map +1 -0
- package/lib/{tui-settings.d.ts → session/tui-settings.d.ts} +2 -2
- package/lib/session/tui-settings.js +42 -0
- package/lib/session/tui-settings.js.map +1 -0
- package/lib/session/update-check.js.map +1 -0
- package/lib/{autocomplete.d.ts → views/autocomplete.d.ts} +1 -1
- package/lib/{autocomplete.js → views/autocomplete.js} +2 -2
- package/lib/views/autocomplete.js.map +1 -0
- package/lib/{copy-selector.d.ts → views/copy-selector.d.ts} +2 -2
- package/lib/{copy-selector.js → views/copy-selector.js} +2 -2
- package/lib/views/copy-selector.js.map +1 -0
- package/lib/views/copy-targets.js.map +1 -0
- package/lib/{event-views.d.ts → views/event-views.d.ts} +8 -8
- package/lib/{event-views.js → views/event-views.js} +64 -25
- package/lib/views/event-views.js.map +1 -0
- package/lib/{history-search.d.ts → views/history-search.d.ts} +2 -2
- package/lib/{history-search.js → views/history-search.js} +3 -3
- package/lib/views/history-search.js.map +1 -0
- package/lib/views/history-store.js.map +1 -0
- package/lib/{hotkeys.d.ts → views/hotkeys.d.ts} +1 -1
- package/lib/{hotkeys.js → views/hotkeys.js} +1 -1
- package/lib/views/hotkeys.js.map +1 -0
- package/lib/{path-complete.d.ts → views/path-complete.d.ts} +2 -2
- package/lib/{path-complete.js → views/path-complete.js} +1 -1
- package/lib/views/path-complete.js.map +1 -0
- package/lib/{prompt-selector.d.ts → views/prompt-selector.d.ts} +2 -2
- package/lib/{prompt-selector.js → views/prompt-selector.js} +4 -4
- package/lib/views/prompt-selector.js.map +1 -0
- package/lib/{settings-list.d.ts → views/settings-list.d.ts} +11 -6
- package/lib/{settings-list.js → views/settings-list.js} +217 -85
- package/lib/views/settings-list.js.map +1 -0
- package/lib/views/transcript-export.js.map +1 -0
- package/package.json +64 -54
- package/lib/autocomplete.js.map +0 -1
- package/lib/box.js.map +0 -1
- package/lib/clipboard.js.map +0 -1
- package/lib/command-auth.js.map +0 -1
- package/lib/command-export.js.map +0 -1
- package/lib/command-integrations.js.map +0 -1
- package/lib/command-loop.js.map +0 -1
- package/lib/command-model.js.map +0 -1
- package/lib/command-output.js.map +0 -1
- package/lib/command-permission.js.map +0 -1
- package/lib/command-registration.js.map +0 -1
- package/lib/command-session.js.map +0 -1
- package/lib/command-steer.js.map +0 -1
- package/lib/copy-selector.js.map +0 -1
- package/lib/copy-targets.js.map +0 -1
- package/lib/editor.js.map +0 -1
- package/lib/event-views.js.map +0 -1
- package/lib/external-editor.js.map +0 -1
- package/lib/history-search.js.map +0 -1
- package/lib/history-store.js.map +0 -1
- package/lib/hotkeys.js.map +0 -1
- package/lib/human-interaction.js.map +0 -1
- package/lib/image-paste.js.map +0 -1
- package/lib/interaction-adapter.js.map +0 -1
- package/lib/keybindings-config.js.map +0 -1
- package/lib/keys.js.map +0 -1
- package/lib/markdown.d.ts +0 -13
- package/lib/markdown.js +0 -453
- package/lib/markdown.js.map +0 -1
- package/lib/package-metadata.js.map +0 -1
- package/lib/path-complete.js.map +0 -1
- package/lib/path-mentions.js.map +0 -1
- package/lib/project-context.js.map +0 -1
- package/lib/project-file-search.js.map +0 -1
- package/lib/prompt-selector.js.map +0 -1
- package/lib/provider-local.js.map +0 -1
- package/lib/relative-time.js.map +0 -1
- package/lib/release-notes.js.map +0 -1
- package/lib/renderer.js.map +0 -1
- package/lib/runner.js.map +0 -1
- package/lib/session-controller.js.map +0 -1
- package/lib/session-runtime.js.map +0 -1
- package/lib/settings-list.js.map +0 -1
- package/lib/startup-notices.js.map +0 -1
- package/lib/status-config.d.ts +0 -32
- package/lib/status-config.js +0 -52
- package/lib/status-config.js.map +0 -1
- package/lib/status-line.js.map +0 -1
- package/lib/style.js.map +0 -1
- package/lib/theme.js +0 -317
- package/lib/theme.js.map +0 -1
- package/lib/tool-presentation.js.map +0 -1
- package/lib/tool-renderers.js.map +0 -1
- package/lib/tools-list.js.map +0 -1
- package/lib/transcript-export.js.map +0 -1
- package/lib/tui-settings.js +0 -26
- package/lib/tui-settings.js.map +0 -1
- package/lib/update-check.js.map +0 -1
- package/lib/welcome-tips.js.map +0 -1
- package/lib/width.js.map +0 -1
- /package/lib/{command-output.d.ts → chrome/command-output.d.ts} +0 -0
- /package/lib/{command-output.js → chrome/command-output.js} +0 -0
- /package/lib/{path-mentions.d.ts → chrome/path-mentions.d.ts} +0 -0
- /package/lib/{path-mentions.js → chrome/path-mentions.js} +0 -0
- /package/lib/{relative-time.d.ts → chrome/relative-time.d.ts} +0 -0
- /package/lib/{relative-time.js → chrome/relative-time.js} +0 -0
- /package/lib/{renderer.d.ts → chrome/renderer.d.ts} +0 -0
- /package/lib/{renderer.js → chrome/renderer.js} +0 -0
- /package/lib/{style.d.ts → chrome/style.d.ts} +0 -0
- /package/lib/{style.js → chrome/style.js} +0 -0
- /package/lib/{tool-renderers.d.ts → chrome/tool-renderers.d.ts} +0 -0
- /package/lib/{tools-list.d.ts → chrome/tools-list.d.ts} +0 -0
- /package/lib/{tools-list.js → chrome/tools-list.js} +0 -0
- /package/lib/{welcome-tips.d.ts → chrome/welcome-tips.d.ts} +0 -0
- /package/lib/{width.d.ts → chrome/width.d.ts} +0 -0
- /package/lib/{width.js → chrome/width.js} +0 -0
- /package/lib/{command-auth.d.ts → commands/auth.d.ts} +0 -0
- /package/lib/{command-export.d.ts → commands/export.d.ts} +0 -0
- /package/lib/{command-integrations.d.ts → commands/integrations.d.ts} +0 -0
- /package/lib/{command-model.d.ts → commands/model.d.ts} +0 -0
- /package/lib/{command-permission.d.ts → commands/permission.d.ts} +0 -0
- /package/lib/{command-registration.d.ts → commands/registration.d.ts} +0 -0
- /package/lib/{command-session.d.ts → commands/session.d.ts} +0 -0
- /package/lib/{command-steer.d.ts → commands/steer.d.ts} +0 -0
- /package/lib/{clipboard.d.ts → input/clipboard.d.ts} +0 -0
- /package/lib/{clipboard.js → input/clipboard.js} +0 -0
- /package/lib/{editor.d.ts → input/editor.d.ts} +0 -0
- /package/lib/{editor.js → input/editor.js} +0 -0
- /package/lib/{external-editor.d.ts → input/external-editor.d.ts} +0 -0
- /package/lib/{external-editor.js → input/external-editor.js} +0 -0
- /package/lib/{image-paste.js → input/image-paste.js} +0 -0
- /package/lib/{keybindings-config.d.ts → input/keybindings-config.d.ts} +0 -0
- /package/lib/{keybindings-config.js → input/keybindings-config.js} +0 -0
- /package/lib/{keys.d.ts → input/keys.d.ts} +0 -0
- /package/lib/{keys.js → input/keys.js} +0 -0
- /package/lib/{human-interaction.d.ts → runtime/human-interaction.d.ts} +0 -0
- /package/lib/{runner.d.ts → runtime/runner.d.ts} +0 -0
- /package/lib/{runner.js → runtime/runner.js} +0 -0
- /package/lib/{startup-notices.d.ts → runtime/startup-notices.d.ts} +0 -0
- /package/lib/{tool-presentation.js → runtime/tool-presentation.js} +0 -0
- /package/lib/{interaction-adapter.js → session/interaction-adapter.js} +0 -0
- /package/lib/{package-metadata.d.ts → session/package-metadata.d.ts} +0 -0
- /package/lib/{project-context.d.ts → session/project-context.d.ts} +0 -0
- /package/lib/{project-context.js → session/project-context.js} +0 -0
- /package/lib/{project-file-search.d.ts → session/project-file-search.d.ts} +0 -0
- /package/lib/{project-file-search.js → session/project-file-search.js} +0 -0
- /package/lib/{release-notes.d.ts → session/release-notes.d.ts} +0 -0
- /package/lib/{release-notes.js → session/release-notes.js} +0 -0
- /package/lib/{update-check.d.ts → session/update-check.d.ts} +0 -0
- /package/lib/{update-check.js → session/update-check.js} +0 -0
- /package/lib/{copy-targets.d.ts → views/copy-targets.d.ts} +0 -0
- /package/lib/{copy-targets.js → views/copy-targets.js} +0 -0
- /package/lib/{history-store.d.ts → views/history-store.d.ts} +0 -0
- /package/lib/{history-store.js → views/history-store.js} +0 -0
- /package/lib/{transcript-export.d.ts → views/transcript-export.d.ts} +0 -0
- /package/lib/{transcript-export.js → views/transcript-export.js} +0 -0
|
@@ -0,0 +1,708 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* oh-my-pi dark theme, ported to Node (no Bun.color). Semantic colors, rounded
|
|
3
|
+
* box chrome, and status glyphs — the visual vocabulary the rest of the view
|
|
4
|
+
* paints with.
|
|
5
|
+
* @module @agi-fans/dsh-tui
|
|
6
|
+
*/
|
|
7
|
+
/** Rounded-box drawing characters (OMP unicode preset). */
|
|
8
|
+
export const BOX = {
|
|
9
|
+
topLeft: '╭',
|
|
10
|
+
topRight: '╮',
|
|
11
|
+
bottomLeft: '╰',
|
|
12
|
+
bottomRight: '╯',
|
|
13
|
+
horizontal: '─',
|
|
14
|
+
vertical: '│',
|
|
15
|
+
teeUp: '┴',
|
|
16
|
+
teeDown: '┬',
|
|
17
|
+
teeLeft: '┤',
|
|
18
|
+
teeRight: '├',
|
|
19
|
+
cross: '┼',
|
|
20
|
+
};
|
|
21
|
+
/** Status / list glyphs matching OMP's unicode symbol preset. */
|
|
22
|
+
export const SYMBOL = {
|
|
23
|
+
success: '✔',
|
|
24
|
+
error: '✘',
|
|
25
|
+
warning: '⚠',
|
|
26
|
+
info: 'ⓘ',
|
|
27
|
+
pending: '⏳',
|
|
28
|
+
running: '⟳',
|
|
29
|
+
done: '•',
|
|
30
|
+
bullet: '•',
|
|
31
|
+
cursor: '❯',
|
|
32
|
+
};
|
|
33
|
+
/** Braille activity spinner (OMP unicode activity frames). */
|
|
34
|
+
export const SPINNER = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
35
|
+
/** OMP `dark.json` palette. */
|
|
36
|
+
const DARK_PALETTE = {
|
|
37
|
+
accent: '#febc38',
|
|
38
|
+
border: '#178fb9',
|
|
39
|
+
borderAccent: '#0088fa',
|
|
40
|
+
borderMuted: '#3d424a',
|
|
41
|
+
success: '#89d281',
|
|
42
|
+
error: '#fc3a4b',
|
|
43
|
+
warning: '#e4c00f',
|
|
44
|
+
muted: '#777d88',
|
|
45
|
+
dim: '#5f6673',
|
|
46
|
+
text: '',
|
|
47
|
+
userMessageText: '',
|
|
48
|
+
userMessageBg: '#221d1a',
|
|
49
|
+
toolPendingBg: '#1d2129',
|
|
50
|
+
toolSuccessBg: '#161a1f',
|
|
51
|
+
toolErrorBg: '#291d1d',
|
|
52
|
+
toolTitle: '',
|
|
53
|
+
toolOutput: '#777d88',
|
|
54
|
+
toolDiffAdded: '#89d281',
|
|
55
|
+
toolDiffRemoved: '#fc3a4b',
|
|
56
|
+
toolDiffContext: '#5f6673',
|
|
57
|
+
mdHeading: '#febc38',
|
|
58
|
+
mdLink: '#0088fa',
|
|
59
|
+
mdLinkUrl: '#5f6673',
|
|
60
|
+
mdCode: '#8a9099',
|
|
61
|
+
mdCodeBlock: '#9cdcfe',
|
|
62
|
+
mdCodeBlockBorder: '#3d424a',
|
|
63
|
+
mdKeyword: '#569cd6',
|
|
64
|
+
mdQuote: '#777d88',
|
|
65
|
+
mdListBullet: '#febc38',
|
|
66
|
+
thinkingText: '#6b7280',
|
|
67
|
+
customMessageLabel: '#b281d6',
|
|
68
|
+
};
|
|
69
|
+
/** OMP `light.json` palette. */
|
|
70
|
+
const LIGHT_PALETTE = {
|
|
71
|
+
accent: '#5a8080',
|
|
72
|
+
border: '#547da7',
|
|
73
|
+
borderAccent: '#5a8080',
|
|
74
|
+
borderMuted: '#b0b0b0',
|
|
75
|
+
success: '#588458',
|
|
76
|
+
error: '#aa5555',
|
|
77
|
+
warning: '#9a7326',
|
|
78
|
+
muted: '#6c6c6c',
|
|
79
|
+
dim: '#767676',
|
|
80
|
+
text: '',
|
|
81
|
+
userMessageText: '',
|
|
82
|
+
userMessageBg: '#e8e8e8',
|
|
83
|
+
toolPendingBg: '#e8e8f0',
|
|
84
|
+
toolSuccessBg: '#e8f0e8',
|
|
85
|
+
toolErrorBg: '#f0e8e8',
|
|
86
|
+
toolTitle: '',
|
|
87
|
+
toolOutput: '#6c6c6c',
|
|
88
|
+
toolDiffAdded: '#588458',
|
|
89
|
+
toolDiffRemoved: '#aa5555',
|
|
90
|
+
toolDiffContext: '#767676',
|
|
91
|
+
mdHeading: '#9a7326',
|
|
92
|
+
mdLink: '#547da7',
|
|
93
|
+
mdLinkUrl: '#767676',
|
|
94
|
+
mdCode: '#5a8080',
|
|
95
|
+
mdCodeBlock: '#5a8080',
|
|
96
|
+
mdCodeBlockBorder: '#6c6c6c',
|
|
97
|
+
mdKeyword: '#0451a5',
|
|
98
|
+
mdQuote: '#6c6c6c',
|
|
99
|
+
mdListBullet: '#588458',
|
|
100
|
+
thinkingText: '#6c6c6c',
|
|
101
|
+
customMessageLabel: '#7e57c2',
|
|
102
|
+
};
|
|
103
|
+
const MIDNIGHT_PALETTE = {
|
|
104
|
+
...DARK_PALETTE,
|
|
105
|
+
accent: '#7aa2f7',
|
|
106
|
+
border: '#3d59a1',
|
|
107
|
+
borderAccent: '#7dcfff',
|
|
108
|
+
borderMuted: '#3d424a',
|
|
109
|
+
success: '#9ece6a',
|
|
110
|
+
error: '#f7768e',
|
|
111
|
+
warning: '#e0af68',
|
|
112
|
+
muted: '#777d88',
|
|
113
|
+
dim: '#5f6673',
|
|
114
|
+
text: '',
|
|
115
|
+
userMessageBg: '#1a1b26',
|
|
116
|
+
toolPendingBg: '#16161e',
|
|
117
|
+
toolSuccessBg: '#1b2430',
|
|
118
|
+
toolErrorBg: '#2a1b26',
|
|
119
|
+
toolOutput: '#777d88',
|
|
120
|
+
toolDiffAdded: '#9ece6a',
|
|
121
|
+
toolDiffRemoved: '#f7768e',
|
|
122
|
+
toolDiffContext: '#5f6673',
|
|
123
|
+
mdHeading: '#bb9af7',
|
|
124
|
+
mdLink: '#7dcfff',
|
|
125
|
+
mdLinkUrl: '#5f6673',
|
|
126
|
+
mdCode: '#7f8799',
|
|
127
|
+
mdCodeBlock: '#9aa5ce',
|
|
128
|
+
mdCodeBlockBorder: '#3d424a',
|
|
129
|
+
mdKeyword: '#bb9af7',
|
|
130
|
+
mdQuote: '#777d88',
|
|
131
|
+
mdListBullet: '#7aa2f7',
|
|
132
|
+
thinkingText: '#6a7394',
|
|
133
|
+
customMessageLabel: '#bb9af7',
|
|
134
|
+
};
|
|
135
|
+
const SOLARIZED_PALETTE = {
|
|
136
|
+
...DARK_PALETTE,
|
|
137
|
+
accent: '#b58900',
|
|
138
|
+
border: '#268bd2',
|
|
139
|
+
borderAccent: '#2aa198',
|
|
140
|
+
borderMuted: '#586e75',
|
|
141
|
+
success: '#859900',
|
|
142
|
+
error: '#dc322f',
|
|
143
|
+
warning: '#cb4b16',
|
|
144
|
+
muted: '#839496',
|
|
145
|
+
dim: '#586e75',
|
|
146
|
+
text: '',
|
|
147
|
+
userMessageBg: '#073642',
|
|
148
|
+
toolPendingBg: '#002b36',
|
|
149
|
+
toolSuccessBg: '#073642',
|
|
150
|
+
toolErrorBg: '#3b2020',
|
|
151
|
+
toolOutput: '#839496',
|
|
152
|
+
toolDiffAdded: '#859900',
|
|
153
|
+
toolDiffRemoved: '#dc322f',
|
|
154
|
+
toolDiffContext: '#586e75',
|
|
155
|
+
mdHeading: '#b58900',
|
|
156
|
+
mdLink: '#268bd2',
|
|
157
|
+
mdLinkUrl: '#586e75',
|
|
158
|
+
mdCode: '#93a1a1',
|
|
159
|
+
mdCodeBlock: '#2aa198',
|
|
160
|
+
mdCodeBlockBorder: '#073642',
|
|
161
|
+
mdKeyword: '#859900',
|
|
162
|
+
mdQuote: '#839496',
|
|
163
|
+
mdListBullet: '#b58900',
|
|
164
|
+
thinkingText: '#586e75',
|
|
165
|
+
customMessageLabel: '#6c71c4',
|
|
166
|
+
};
|
|
167
|
+
const CATPPUCCIN_PALETTE = {
|
|
168
|
+
...DARK_PALETTE,
|
|
169
|
+
accent: '#fab387',
|
|
170
|
+
border: '#89b4fa',
|
|
171
|
+
borderAccent: '#b4befe',
|
|
172
|
+
borderMuted: '#313244',
|
|
173
|
+
success: '#a6e3a1',
|
|
174
|
+
error: '#f38ba8',
|
|
175
|
+
warning: '#f9e2af',
|
|
176
|
+
muted: '#7f849c',
|
|
177
|
+
dim: '#6c7086',
|
|
178
|
+
text: '',
|
|
179
|
+
userMessageBg: '#181825',
|
|
180
|
+
toolPendingBg: '#313244',
|
|
181
|
+
toolSuccessBg: '#181825',
|
|
182
|
+
toolErrorBg: '#11111b',
|
|
183
|
+
toolTitle: '#b4befe',
|
|
184
|
+
toolOutput: '#7f849c',
|
|
185
|
+
toolDiffAdded: '#a6e3a1',
|
|
186
|
+
toolDiffRemoved: '#f38ba8',
|
|
187
|
+
toolDiffContext: '#7f849c',
|
|
188
|
+
mdHeading: '#fab387',
|
|
189
|
+
mdLink: '#89b4fa',
|
|
190
|
+
mdLinkUrl: '#6c7086',
|
|
191
|
+
mdCode: '#a6adc8',
|
|
192
|
+
mdCodeBlock: '#cdd6f4',
|
|
193
|
+
mdCodeBlockBorder: '#313244',
|
|
194
|
+
mdKeyword: '#cba6f7',
|
|
195
|
+
mdQuote: '#7f849c',
|
|
196
|
+
mdListBullet: '#fab387',
|
|
197
|
+
thinkingText: '#6c7086',
|
|
198
|
+
customMessageLabel: '#cba6f7',
|
|
199
|
+
};
|
|
200
|
+
const DRACULA_PALETTE = {
|
|
201
|
+
...DARK_PALETTE,
|
|
202
|
+
accent: '#bd93f9',
|
|
203
|
+
border: '#bd93f9',
|
|
204
|
+
borderAccent: '#ff79c6',
|
|
205
|
+
borderMuted: '#44475a',
|
|
206
|
+
success: '#50fa7b',
|
|
207
|
+
error: '#ff5555',
|
|
208
|
+
warning: '#f1fa8c',
|
|
209
|
+
muted: '#6272a4',
|
|
210
|
+
dim: '#44475a',
|
|
211
|
+
text: '',
|
|
212
|
+
userMessageBg: '#1f2029',
|
|
213
|
+
toolPendingBg: '#21222c',
|
|
214
|
+
toolSuccessBg: '#1a1f1e',
|
|
215
|
+
toolErrorBg: '#2a2028',
|
|
216
|
+
toolTitle: '#8be9fd',
|
|
217
|
+
toolOutput: '#6272a4',
|
|
218
|
+
toolDiffAdded: '#50fa7b',
|
|
219
|
+
toolDiffRemoved: '#ff5555',
|
|
220
|
+
toolDiffContext: '#6272a4',
|
|
221
|
+
mdHeading: '#bd93f9',
|
|
222
|
+
mdLink: '#8be9fd',
|
|
223
|
+
mdLinkUrl: '#6272a4',
|
|
224
|
+
mdCode: '#9aa3c7',
|
|
225
|
+
mdCodeBlock: '#f8f8f2',
|
|
226
|
+
mdCodeBlockBorder: '#44475a',
|
|
227
|
+
mdKeyword: '#ff79c6',
|
|
228
|
+
mdQuote: '#6272a4',
|
|
229
|
+
mdListBullet: '#ff79c6',
|
|
230
|
+
thinkingText: '#6272a4',
|
|
231
|
+
customMessageLabel: '#bd93f9',
|
|
232
|
+
};
|
|
233
|
+
const NORD_PALETTE = {
|
|
234
|
+
...DARK_PALETTE,
|
|
235
|
+
accent: '#88c0d0',
|
|
236
|
+
border: '#5e81ac',
|
|
237
|
+
borderAccent: '#88c0d0',
|
|
238
|
+
borderMuted: '#434c5e',
|
|
239
|
+
success: '#a3be8c',
|
|
240
|
+
error: '#bf616a',
|
|
241
|
+
warning: '#ebcb8b',
|
|
242
|
+
muted: '#7b88a1',
|
|
243
|
+
dim: '#4c566a',
|
|
244
|
+
text: '',
|
|
245
|
+
userMessageBg: '#3b4252',
|
|
246
|
+
toolPendingBg: '#3b4252',
|
|
247
|
+
toolSuccessBg: '#2e3440',
|
|
248
|
+
toolErrorBg: '#3b2f31',
|
|
249
|
+
toolTitle: '#88c0d0',
|
|
250
|
+
toolOutput: '#7b88a1',
|
|
251
|
+
toolDiffAdded: '#a3be8c',
|
|
252
|
+
toolDiffRemoved: '#bf616a',
|
|
253
|
+
toolDiffContext: '#7b88a1',
|
|
254
|
+
mdHeading: '#88c0d0',
|
|
255
|
+
mdLink: '#88c0d0',
|
|
256
|
+
mdLinkUrl: '#4c566a',
|
|
257
|
+
mdCode: '#81a1c1',
|
|
258
|
+
mdCodeBlock: '#d8dee9',
|
|
259
|
+
mdCodeBlockBorder: '#434c5e',
|
|
260
|
+
mdKeyword: '#81a1c1',
|
|
261
|
+
mdQuote: '#7b88a1',
|
|
262
|
+
mdListBullet: '#81a1c1',
|
|
263
|
+
thinkingText: '#6b768d',
|
|
264
|
+
customMessageLabel: '#b48ead',
|
|
265
|
+
};
|
|
266
|
+
const GRUVBOX_PALETTE = {
|
|
267
|
+
...DARK_PALETTE,
|
|
268
|
+
accent: '#fe8019',
|
|
269
|
+
border: '#458588',
|
|
270
|
+
borderAccent: '#8ec07c',
|
|
271
|
+
borderMuted: '#504945',
|
|
272
|
+
success: '#b8bb26',
|
|
273
|
+
error: '#fb4934',
|
|
274
|
+
warning: '#fabd2f',
|
|
275
|
+
muted: '#928374',
|
|
276
|
+
dim: '#7c6f64',
|
|
277
|
+
text: '',
|
|
278
|
+
userMessageBg: '#1d2021',
|
|
279
|
+
toolPendingBg: '#32302f',
|
|
280
|
+
toolSuccessBg: '#1d2021',
|
|
281
|
+
toolErrorBg: '#3c2021',
|
|
282
|
+
toolTitle: '#ebdbb2',
|
|
283
|
+
toolOutput: '#928374',
|
|
284
|
+
toolDiffAdded: '#b8bb26',
|
|
285
|
+
toolDiffRemoved: '#fb4934',
|
|
286
|
+
toolDiffContext: '#928374',
|
|
287
|
+
mdHeading: '#fabd2f',
|
|
288
|
+
mdLink: '#8ec07c',
|
|
289
|
+
mdLinkUrl: '#7c6f64',
|
|
290
|
+
mdCode: '#bdae93',
|
|
291
|
+
mdCodeBlock: '#ebdbb2',
|
|
292
|
+
mdCodeBlockBorder: '#504945',
|
|
293
|
+
mdKeyword: '#d3869b',
|
|
294
|
+
mdQuote: '#928374',
|
|
295
|
+
mdListBullet: '#fe8019',
|
|
296
|
+
thinkingText: '#7c6f64',
|
|
297
|
+
customMessageLabel: '#d3869b',
|
|
298
|
+
};
|
|
299
|
+
const ROSE_PINE_PALETTE = {
|
|
300
|
+
...DARK_PALETTE,
|
|
301
|
+
accent: '#c4a7e7',
|
|
302
|
+
border: '#31748f',
|
|
303
|
+
borderAccent: '#9ccfd8',
|
|
304
|
+
borderMuted: '#403d52',
|
|
305
|
+
success: '#9ccfd8',
|
|
306
|
+
error: '#eb6f92',
|
|
307
|
+
warning: '#f6c177',
|
|
308
|
+
muted: '#6e6a86',
|
|
309
|
+
dim: '#524f67',
|
|
310
|
+
text: '',
|
|
311
|
+
userMessageBg: '#21202e',
|
|
312
|
+
toolPendingBg: '#1f1d2e',
|
|
313
|
+
toolSuccessBg: '#21202e',
|
|
314
|
+
toolErrorBg: '#2d1f26',
|
|
315
|
+
toolTitle: '#9ccfd8',
|
|
316
|
+
toolOutput: '#6e6a86',
|
|
317
|
+
toolDiffAdded: '#9ccfd8',
|
|
318
|
+
toolDiffRemoved: '#eb6f92',
|
|
319
|
+
toolDiffContext: '#6e6a86',
|
|
320
|
+
mdHeading: '#c4a7e7',
|
|
321
|
+
mdLink: '#9ccfd8',
|
|
322
|
+
mdLinkUrl: '#908caa',
|
|
323
|
+
mdCode: '#a8a4c4',
|
|
324
|
+
mdCodeBlock: '#e0def4',
|
|
325
|
+
mdCodeBlockBorder: '#403d52',
|
|
326
|
+
mdKeyword: '#31748f',
|
|
327
|
+
mdQuote: '#6e6a86',
|
|
328
|
+
mdListBullet: '#c4a7e7',
|
|
329
|
+
thinkingText: '#6e6a86',
|
|
330
|
+
customMessageLabel: '#c4a7e7',
|
|
331
|
+
};
|
|
332
|
+
const MONO_PALETTE = {
|
|
333
|
+
accent: '#e8e8e8',
|
|
334
|
+
border: '#888888',
|
|
335
|
+
borderAccent: '#b8b8b8',
|
|
336
|
+
borderMuted: '#444444',
|
|
337
|
+
success: '#c0c0c0',
|
|
338
|
+
error: '#f0f0f0',
|
|
339
|
+
warning: '#a8a8a8',
|
|
340
|
+
muted: '#888888',
|
|
341
|
+
dim: '#666666',
|
|
342
|
+
text: '',
|
|
343
|
+
userMessageText: '',
|
|
344
|
+
userMessageBg: '#202020',
|
|
345
|
+
toolPendingBg: '#242424',
|
|
346
|
+
toolSuccessBg: '#1c1c1c',
|
|
347
|
+
toolErrorBg: '#2a2a2a',
|
|
348
|
+
toolTitle: '',
|
|
349
|
+
toolOutput: '#888888',
|
|
350
|
+
toolDiffAdded: '#c0c0c0',
|
|
351
|
+
toolDiffRemoved: '#f0f0f0',
|
|
352
|
+
toolDiffContext: '#666666',
|
|
353
|
+
mdHeading: '#e8e8e8',
|
|
354
|
+
mdLink: '#b8b8b8',
|
|
355
|
+
mdLinkUrl: '#666666',
|
|
356
|
+
mdCode: '#a0a0a0',
|
|
357
|
+
mdCodeBlock: '#c0c0c0',
|
|
358
|
+
mdCodeBlockBorder: '#444444',
|
|
359
|
+
mdKeyword: '#b8b8b8',
|
|
360
|
+
mdQuote: '#888888',
|
|
361
|
+
mdListBullet: '#b8b8b8',
|
|
362
|
+
thinkingText: '#767676',
|
|
363
|
+
customMessageLabel: '#a8a8a8',
|
|
364
|
+
};
|
|
365
|
+
const PALETTES = {
|
|
366
|
+
dark: DARK_PALETTE,
|
|
367
|
+
light: LIGHT_PALETTE,
|
|
368
|
+
midnight: MIDNIGHT_PALETTE,
|
|
369
|
+
solarized: SOLARIZED_PALETTE,
|
|
370
|
+
catppuccin: CATPPUCCIN_PALETTE,
|
|
371
|
+
dracula: DRACULA_PALETTE,
|
|
372
|
+
nord: NORD_PALETTE,
|
|
373
|
+
gruvbox: GRUVBOX_PALETTE,
|
|
374
|
+
'rose-pine': ROSE_PINE_PALETTE,
|
|
375
|
+
mono: MONO_PALETTE,
|
|
376
|
+
};
|
|
377
|
+
/** 16-color fallbacks when the terminal is not truecolor. */
|
|
378
|
+
const DARK_ANSI16 = {
|
|
379
|
+
accent: '33',
|
|
380
|
+
border: '36',
|
|
381
|
+
borderAccent: '36',
|
|
382
|
+
borderMuted: '90',
|
|
383
|
+
success: '32',
|
|
384
|
+
error: '31',
|
|
385
|
+
warning: '33',
|
|
386
|
+
muted: '37',
|
|
387
|
+
dim: '90',
|
|
388
|
+
text: '39',
|
|
389
|
+
userMessageText: '39',
|
|
390
|
+
userMessageBg: '40',
|
|
391
|
+
toolPendingBg: '40',
|
|
392
|
+
toolSuccessBg: '40',
|
|
393
|
+
toolErrorBg: '41',
|
|
394
|
+
toolTitle: '39',
|
|
395
|
+
toolOutput: '37',
|
|
396
|
+
toolDiffAdded: '32',
|
|
397
|
+
toolDiffRemoved: '31',
|
|
398
|
+
toolDiffContext: '90',
|
|
399
|
+
mdHeading: '33',
|
|
400
|
+
mdLink: '36',
|
|
401
|
+
mdLinkUrl: '90',
|
|
402
|
+
mdCode: '90',
|
|
403
|
+
mdCodeBlock: '36',
|
|
404
|
+
mdCodeBlockBorder: '90',
|
|
405
|
+
mdKeyword: '36',
|
|
406
|
+
mdQuote: '37',
|
|
407
|
+
mdListBullet: '33',
|
|
408
|
+
thinkingText: '90',
|
|
409
|
+
customMessageLabel: '35',
|
|
410
|
+
};
|
|
411
|
+
const LIGHT_ANSI16 = {
|
|
412
|
+
accent: '36',
|
|
413
|
+
border: '34',
|
|
414
|
+
borderAccent: '36',
|
|
415
|
+
borderMuted: '90',
|
|
416
|
+
success: '32',
|
|
417
|
+
error: '31',
|
|
418
|
+
warning: '33',
|
|
419
|
+
muted: '30',
|
|
420
|
+
dim: '90',
|
|
421
|
+
text: '39',
|
|
422
|
+
userMessageText: '39',
|
|
423
|
+
userMessageBg: '47',
|
|
424
|
+
toolPendingBg: '47',
|
|
425
|
+
toolSuccessBg: '42',
|
|
426
|
+
toolErrorBg: '41',
|
|
427
|
+
toolTitle: '39',
|
|
428
|
+
toolOutput: '30',
|
|
429
|
+
toolDiffAdded: '32',
|
|
430
|
+
toolDiffRemoved: '31',
|
|
431
|
+
toolDiffContext: '90',
|
|
432
|
+
mdHeading: '33',
|
|
433
|
+
mdLink: '34',
|
|
434
|
+
mdLinkUrl: '90',
|
|
435
|
+
mdCode: '90',
|
|
436
|
+
mdCodeBlock: '36',
|
|
437
|
+
mdCodeBlockBorder: '90',
|
|
438
|
+
mdKeyword: '34',
|
|
439
|
+
mdQuote: '30',
|
|
440
|
+
mdListBullet: '32',
|
|
441
|
+
thinkingText: '90',
|
|
442
|
+
customMessageLabel: '35',
|
|
443
|
+
};
|
|
444
|
+
const MIDNIGHT_ANSI16 = {
|
|
445
|
+
...DARK_ANSI16,
|
|
446
|
+
accent: '34',
|
|
447
|
+
border: '34',
|
|
448
|
+
borderAccent: '36',
|
|
449
|
+
mdHeading: '35',
|
|
450
|
+
mdLink: '36',
|
|
451
|
+
mdKeyword: '35',
|
|
452
|
+
mdListBullet: '34',
|
|
453
|
+
customMessageLabel: '35',
|
|
454
|
+
};
|
|
455
|
+
const SOLARIZED_ANSI16 = {
|
|
456
|
+
...DARK_ANSI16,
|
|
457
|
+
accent: '33',
|
|
458
|
+
border: '34',
|
|
459
|
+
borderAccent: '36',
|
|
460
|
+
mdHeading: '33',
|
|
461
|
+
mdLink: '34',
|
|
462
|
+
mdKeyword: '32',
|
|
463
|
+
mdCodeBlock: '36',
|
|
464
|
+
mdListBullet: '33',
|
|
465
|
+
customMessageLabel: '35',
|
|
466
|
+
};
|
|
467
|
+
const CATPPUCCIN_ANSI16 = {
|
|
468
|
+
...DARK_ANSI16,
|
|
469
|
+
accent: '33',
|
|
470
|
+
border: '34',
|
|
471
|
+
borderAccent: '35',
|
|
472
|
+
mdHeading: '33',
|
|
473
|
+
mdLink: '34',
|
|
474
|
+
mdKeyword: '35',
|
|
475
|
+
mdListBullet: '33',
|
|
476
|
+
customMessageLabel: '35',
|
|
477
|
+
};
|
|
478
|
+
const DRACULA_ANSI16 = {
|
|
479
|
+
...DARK_ANSI16,
|
|
480
|
+
accent: '35',
|
|
481
|
+
border: '35',
|
|
482
|
+
borderAccent: '35',
|
|
483
|
+
mdHeading: '35',
|
|
484
|
+
mdLink: '36',
|
|
485
|
+
mdKeyword: '35',
|
|
486
|
+
mdListBullet: '35',
|
|
487
|
+
customMessageLabel: '35',
|
|
488
|
+
};
|
|
489
|
+
const NORD_ANSI16 = {
|
|
490
|
+
...DARK_ANSI16,
|
|
491
|
+
accent: '36',
|
|
492
|
+
border: '34',
|
|
493
|
+
borderAccent: '36',
|
|
494
|
+
mdHeading: '36',
|
|
495
|
+
mdLink: '36',
|
|
496
|
+
mdKeyword: '34',
|
|
497
|
+
mdListBullet: '34',
|
|
498
|
+
customMessageLabel: '35',
|
|
499
|
+
};
|
|
500
|
+
const GRUVBOX_ANSI16 = {
|
|
501
|
+
...DARK_ANSI16,
|
|
502
|
+
accent: '33',
|
|
503
|
+
border: '36',
|
|
504
|
+
borderAccent: '32',
|
|
505
|
+
mdHeading: '33',
|
|
506
|
+
mdLink: '32',
|
|
507
|
+
mdKeyword: '35',
|
|
508
|
+
mdListBullet: '33',
|
|
509
|
+
customMessageLabel: '35',
|
|
510
|
+
};
|
|
511
|
+
const ROSE_PINE_ANSI16 = {
|
|
512
|
+
...DARK_ANSI16,
|
|
513
|
+
accent: '35',
|
|
514
|
+
border: '36',
|
|
515
|
+
borderAccent: '36',
|
|
516
|
+
mdHeading: '35',
|
|
517
|
+
mdLink: '36',
|
|
518
|
+
mdKeyword: '36',
|
|
519
|
+
mdListBullet: '35',
|
|
520
|
+
customMessageLabel: '35',
|
|
521
|
+
};
|
|
522
|
+
const MONO_ANSI16 = {
|
|
523
|
+
...DARK_ANSI16,
|
|
524
|
+
accent: '97',
|
|
525
|
+
border: '37',
|
|
526
|
+
borderAccent: '97',
|
|
527
|
+
success: '37',
|
|
528
|
+
error: '97',
|
|
529
|
+
warning: '37',
|
|
530
|
+
muted: '37',
|
|
531
|
+
mdHeading: '97',
|
|
532
|
+
mdLink: '37',
|
|
533
|
+
mdCodeBlock: '37',
|
|
534
|
+
mdKeyword: '37',
|
|
535
|
+
mdListBullet: '37',
|
|
536
|
+
customMessageLabel: '37',
|
|
537
|
+
};
|
|
538
|
+
const ANSI16 = {
|
|
539
|
+
dark: DARK_ANSI16,
|
|
540
|
+
light: LIGHT_ANSI16,
|
|
541
|
+
midnight: MIDNIGHT_ANSI16,
|
|
542
|
+
solarized: SOLARIZED_ANSI16,
|
|
543
|
+
catppuccin: CATPPUCCIN_ANSI16,
|
|
544
|
+
dracula: DRACULA_ANSI16,
|
|
545
|
+
nord: NORD_ANSI16,
|
|
546
|
+
gruvbox: GRUVBOX_ANSI16,
|
|
547
|
+
'rose-pine': ROSE_PINE_ANSI16,
|
|
548
|
+
mono: MONO_ANSI16,
|
|
549
|
+
};
|
|
550
|
+
const FG_RESET = '\x1b[39m';
|
|
551
|
+
const BG_RESET = '\x1b[49m';
|
|
552
|
+
const BOLD_RESET = '\x1b[22m';
|
|
553
|
+
const ITALIC_RESET = '\x1b[23m';
|
|
554
|
+
const UNDERLINE_RESET = '\x1b[24m';
|
|
555
|
+
const STRIKE_RESET = '\x1b[29m';
|
|
556
|
+
const INVERSE_RESET = '\x1b[27m';
|
|
557
|
+
/** Built-in palettes, including a few well-known oh-my-pi coding themes. */
|
|
558
|
+
export const THEME_NAMES = [
|
|
559
|
+
'dark', 'light', 'midnight', 'solarized',
|
|
560
|
+
'catppuccin', 'dracula', 'nord', 'gruvbox', 'rose-pine',
|
|
561
|
+
'mono',
|
|
562
|
+
];
|
|
563
|
+
/** True when `value` is a shipped palette name. */
|
|
564
|
+
export function isThemeName(value) {
|
|
565
|
+
return THEME_NAMES.includes(value);
|
|
566
|
+
}
|
|
567
|
+
/** Normalize a config/CLI token to a palette name (`dark` when unknown). */
|
|
568
|
+
export function parseThemeName(value) {
|
|
569
|
+
return value !== undefined && isThemeName(value) ? value : 'dark';
|
|
570
|
+
}
|
|
571
|
+
function hexToRgb(hex) {
|
|
572
|
+
const body = hex.startsWith('#') ? hex.slice(1) : hex;
|
|
573
|
+
return [
|
|
574
|
+
Number.parseInt(body.slice(0, 2), 16),
|
|
575
|
+
Number.parseInt(body.slice(2, 4), 16),
|
|
576
|
+
Number.parseInt(body.slice(4, 6), 16),
|
|
577
|
+
];
|
|
578
|
+
}
|
|
579
|
+
function fgCode(swatch, trueColor, fallback) {
|
|
580
|
+
if (swatch === '')
|
|
581
|
+
return '\x1b[39m';
|
|
582
|
+
if (typeof swatch === 'number')
|
|
583
|
+
return `\x1b[38;5;${swatch}m`;
|
|
584
|
+
if (!trueColor)
|
|
585
|
+
return `\x1b[${fallback}m`;
|
|
586
|
+
const [r, g, b] = hexToRgb(swatch);
|
|
587
|
+
return `\x1b[38;2;${r};${g};${b}m`;
|
|
588
|
+
}
|
|
589
|
+
function bgCode(swatch, trueColor, fallback) {
|
|
590
|
+
if (swatch === '')
|
|
591
|
+
return '\x1b[49m';
|
|
592
|
+
if (typeof swatch === 'number')
|
|
593
|
+
return `\x1b[48;5;${swatch}m`;
|
|
594
|
+
if (!trueColor)
|
|
595
|
+
return `\x1b[${fallback}m`;
|
|
596
|
+
const [r, g, b] = hexToRgb(swatch);
|
|
597
|
+
return `\x1b[48;2;${r};${g};${b}m`;
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* Detect 24-bit color the way OMP does: COLORTERM, Windows Terminal, else
|
|
601
|
+
* assume truecolor unless TERM is a known 16-color host.
|
|
602
|
+
*/
|
|
603
|
+
export function detectTrueColor(env = process.env) {
|
|
604
|
+
const colorterm = env.COLORTERM ?? '';
|
|
605
|
+
if (colorterm === 'truecolor' || colorterm === '24bit')
|
|
606
|
+
return true;
|
|
607
|
+
if (env.WT_SESSION)
|
|
608
|
+
return true;
|
|
609
|
+
const term = env.TERM ?? '';
|
|
610
|
+
if (term === 'dumb' || term === '' || term === 'linux')
|
|
611
|
+
return false;
|
|
612
|
+
return true;
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Build a theme.
|
|
616
|
+
* @param colors - emit SGR when true.
|
|
617
|
+
* @param trueColor - 24-bit hex; ignored when colors is false.
|
|
618
|
+
* @param name - shipped palette (`dark` default).
|
|
619
|
+
*/
|
|
620
|
+
export function createTheme(colors, trueColor = detectTrueColor(), name = 'dark') {
|
|
621
|
+
const tc = colors && trueColor;
|
|
622
|
+
const palette = PALETTES[name];
|
|
623
|
+
const ansi = ANSI16[name];
|
|
624
|
+
const getFgAnsi = (color) => colors ? fgCode(palette[color], tc, ansi[color]) : '';
|
|
625
|
+
const getBgAnsi = (color) => colors ? bgCode(palette[color], tc, ansi[color]) : '';
|
|
626
|
+
const paint = (open, text, close) => colors && open !== '' ? open + text + close : text;
|
|
627
|
+
return {
|
|
628
|
+
name,
|
|
629
|
+
colors,
|
|
630
|
+
trueColor: tc,
|
|
631
|
+
getFgAnsi,
|
|
632
|
+
getBgAnsi,
|
|
633
|
+
fg: (color, text) => paint(getFgAnsi(color), text, FG_RESET),
|
|
634
|
+
bg: (color, text) => paint(getBgAnsi(color), text, BG_RESET),
|
|
635
|
+
bold: (text) => (colors ? `\x1b[1m${text}${BOLD_RESET}` : text),
|
|
636
|
+
italic: (text) => (colors ? `\x1b[3m${text}${ITALIC_RESET}` : text),
|
|
637
|
+
underline: (text) => (colors ? `\x1b[4m${text}${UNDERLINE_RESET}` : text),
|
|
638
|
+
strikethrough: (text) => (colors ? `\x1b[9m${text}${STRIKE_RESET}` : text),
|
|
639
|
+
dim: (text) => paint(getFgAnsi('dim'), text, FG_RESET),
|
|
640
|
+
inverse: (text) => (colors ? `\x1b[7m${text}${INVERSE_RESET}` : text),
|
|
641
|
+
};
|
|
642
|
+
}
|
|
643
|
+
/** DeepSeek mark adapted from the official SVG for a 20×6 terminal cell. */
|
|
644
|
+
export const DEEPSEEK_LOGO = [
|
|
645
|
+
' ⢀⣀ ⢀⡀ ',
|
|
646
|
+
'⢀⣤⣶⣿⣿⣿⣿⣿⣿⣿⣧⣄⡀⢻⣿⣷⣶⣶⣶⡿',
|
|
647
|
+
'⣿⡟⠛⠛⠛⠿⢿⣿⣿⣿⣿⡿⢿⣷⣾⣿⣿⠉⠉ ',
|
|
648
|
+
'⢻⣿⣄⡀ ⢀⠈⠛⢿⣿⣿⣶⣿⣿⡿⠃ ',
|
|
649
|
+
' ⠙⠻⢿⣶⣦⣼⣿⣷⣦⣭⣿⠿⣿⣷⠦ ',
|
|
650
|
+
' ⠉⠉⠉⠉⠉⠁ ',
|
|
651
|
+
];
|
|
652
|
+
/** @deprecated Use {@link DEEPSEEK_LOGO}; retained for API compatibility. */
|
|
653
|
+
export const PI_LOGO = [
|
|
654
|
+
'▀██████████▀',
|
|
655
|
+
' ╘██ ██ ',
|
|
656
|
+
' ██ ██ ',
|
|
657
|
+
' ██ ██ ',
|
|
658
|
+
' ▄██▄ ▄██▄ ',
|
|
659
|
+
];
|
|
660
|
+
const GRADIENT_STOPS = [
|
|
661
|
+
[255, 92, 200],
|
|
662
|
+
[200, 110, 255],
|
|
663
|
+
[120, 130, 255],
|
|
664
|
+
[60, 200, 255],
|
|
665
|
+
[120, 255, 220],
|
|
666
|
+
];
|
|
667
|
+
const GRADIENT_RAMP_256 = [199, 171, 135, 99, 75, 51, 87];
|
|
668
|
+
function gradientEscape(t, trueColor) {
|
|
669
|
+
if (trueColor) {
|
|
670
|
+
const seg = t * (GRADIENT_STOPS.length - 1);
|
|
671
|
+
const i = Math.min(GRADIENT_STOPS.length - 2, Math.floor(seg));
|
|
672
|
+
const f = seg - i;
|
|
673
|
+
const a = GRADIENT_STOPS[i] ?? GRADIENT_STOPS[0];
|
|
674
|
+
const b = GRADIENT_STOPS[i + 1] ?? a;
|
|
675
|
+
const r = Math.round(a[0] + (b[0] - a[0]) * f);
|
|
676
|
+
const g = Math.round(a[1] + (b[1] - a[1]) * f);
|
|
677
|
+
const bl = Math.round(a[2] + (b[2] - a[2]) * f);
|
|
678
|
+
return `\x1b[38;2;${r};${g};${bl}m`;
|
|
679
|
+
}
|
|
680
|
+
const idx = Math.min(GRADIENT_RAMP_256.length - 1, Math.max(0, Math.floor(t * (GRADIENT_RAMP_256.length - 1) + 0.5)));
|
|
681
|
+
return `\x1b[38;5;${GRADIENT_RAMP_256[idx]}m`;
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* Diagonal gradient across the DeepSeek logo.
|
|
685
|
+
* Unstyled when colors are off.
|
|
686
|
+
*/
|
|
687
|
+
export function gradientLogo(theme, lines = DEEPSEEK_LOGO) {
|
|
688
|
+
if (!theme.colors)
|
|
689
|
+
return [...lines];
|
|
690
|
+
const reset = FG_RESET;
|
|
691
|
+
const rows = lines.length;
|
|
692
|
+
const cols = Math.max(0, ...lines.map((line) => line.length));
|
|
693
|
+
const span = Math.max(1, cols + rows - 1);
|
|
694
|
+
return lines.map((line, y) => {
|
|
695
|
+
let out = '';
|
|
696
|
+
for (let x = 0; x < line.length; x += 1) {
|
|
697
|
+
const ch = line[x] ?? ' ';
|
|
698
|
+
if (ch === ' ') {
|
|
699
|
+
out += ch;
|
|
700
|
+
continue;
|
|
701
|
+
}
|
|
702
|
+
const t = (x + (rows - 1 - y)) / span;
|
|
703
|
+
out += gradientEscape(t, theme.trueColor) + ch + reset;
|
|
704
|
+
}
|
|
705
|
+
return out;
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
//# sourceMappingURL=theme.js.map
|