Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/tui/src/config/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@ export const ScrollAcceleration = Schema.Struct({
export const DiffStyle = Schema.Literals(["auto", "stacked"]).annotate({
description: "Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column",
})
export const Syntax = Schema.Struct({
bash: Schema.optional(Schema.Boolean).annotate({
description: "Color the bash tool's command as shell code (default: true)",
}),
tool_output: Schema.optional(Schema.Record(Schema.String, Schema.String)).annotate({
description:
"Color plugin and MCP tool output by tool name or glob ('browser', 'github_*', '*'): a language id such as 'json', 'auto' to color output recognized as JSON, or 'none'. An exact name wins over globs, the most specific glob over the rest. Unset leaves output plain (default)",
}),
file_output: Schema.optional(Schema.Boolean).annotate({
description:
"Color tool output that shows the contents of files in each file's language: bash reads and searches (cat, sed -n, head, tail, grep, rg, git show <ref>:<path>), JSON and diffs, the read and grep tools, GitHub code search snippets and docs with fenced code. A path or line number a line starts with is muted. Read and grep calls can be clicked to show what they found. Output whose language is unclear stays plain, and a tool set to 'none' in tool_output stays plain (default: false)",
}),
}).annotate({ description: "Syntax highlighting in tool calls" })
export const Cursor = Schema.Struct({
style: Schema.optional(Schema.Literals(["block", "underline", "line", "default"])).annotate({
description: "Cursor shape. Use 'default' to preserve the terminal setting",
Expand Down Expand Up @@ -70,6 +83,7 @@ export const Info = Schema.Struct({
scroll_speed: Schema.optional(ScrollSpeed).annotate({ description: "TUI scroll speed" }),
scroll_acceleration: Schema.optional(ScrollAcceleration),
diff_style: Schema.optional(DiffStyle),
syntax: Schema.optional(Syntax),
cursor: Schema.optional(Cursor),
mouse: Schema.optional(Schema.Boolean).annotate({ description: "Enable or disable mouse capture (default: true)" }),
})
Expand Down
3 changes: 3 additions & 0 deletions packages/tui/src/context/theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
upsertTheme,
type ThemeJson,
} from "../theme"
import { toolCodeTheme } from "../theme/tool-code"
import { createEffect, createMemo, onCleanup, onMount } from "solid-js"
import { createStore, produce } from "solid-js/store"
import { createSimpleContext } from "./helper"
Expand Down Expand Up @@ -270,6 +271,7 @@ export const { use: useTheme, provider: ThemeProvider } = createSimpleContext({

const syntax = createSyntaxStyleMemo(() => generateSyntax(values()))
const subtleSyntax = createSyntaxStyleMemo(() => generateSubtleSyntax(values()))
const toolSyntax = createSyntaxStyleMemo(() => generateSyntax(toolCodeTheme(values())))

return {
theme: new Proxy(values(), {
Expand All @@ -285,6 +287,7 @@ export const { use: useTheme, provider: ThemeProvider } = createSimpleContext({
has: hasTheme,
syntax,
subtleSyntax,
toolSyntax,
mode: () => store.mode,
locked: () => store.lock !== undefined,
lock: () => pin(store.mode),
Expand Down
Loading
Loading