Skip to content

Commit 3127103

Browse files
d4ncerclaude
andcommitted
docs(knowledge): add theme-color checklist and markdown rendering architecture
New knowledge entries documenting the steps for adding theme colors and the TUI markdown rendering pipeline. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9c2ff4e commit 3127103

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: "Theme Color Addition Checklist"
3+
tags: [ui, theme, color, input]
4+
created_at: "2026-02-26T04:17:39.349012+00:00"
5+
---
6+
7+
When adding a new color to the TUI theme system, all these locations must be updated:
8+
9+
1. `Theme` struct field in `src/ui/theme.rs`
10+
2. `Theme::dark()` constructor
11+
3. `Theme::light()` constructor
12+
4. `ColorOverrides` struct (with `Option<String>` field)
13+
5. `ColorOverrides::validate()` field list
14+
6. `ColorOverrides::apply_to()` set call
15+
7. Style accessor function (e.g. `pub fn input_text() -> Style`)
16+
8. `color_overrides_all_fields` test
17+
18+
Use `Color::Reset` when you want the terminal's native fg/bg to show through — this is the safest default for text that must be readable on any terminal background.
19+
20+
See also: [[Ratatui UI Runtime]], [[TUI Input Model (v0.8.1+)]]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: "TUI Markdown Rendering Architecture"
3+
tags: [ui, theme, markdown, tui, view]
4+
created_at: "2026-02-26T04:49:57.071673+00:00"
5+
---
6+
7+
Agent stream markdown rendering in the TUI uses ratatui native `Span`/`Line` styling (not ANSI escapes). The rendering pipeline:
8+
9+
1. `src/ui/state.rs``AgentText` events: trims leading whitespace on first chunk, collapses 3+ consecutive newlines into 2
10+
2. `src/ui/view.rs``render_agent_markdown()` parses `state.agent_text` into `Vec<Line<'static>>` with styled spans
11+
3. Supported elements: fenced code blocks (code_block style), headings (heading style, bold), blockquotes (italic, `` prefix), list bullets (colored bullet/number), horizontal rules (40-char `` line), inline code/bold/italic/links
12+
4. `parse_inline_markdown()` handles inline elements returning `Vec<Span<'static>>`
13+
14+
Tool activity uses `ToolLine { name, summary }` struct. Detail lines have empty `name`. Rendered as: tool_name style + accent arrow + subdued summary.
15+
16+
Theme tokens added in v0.8.1+: `heading_fg`, `code_span_fg`, `code_block_fg`, `link_fg`, `blockquote_fg`, `list_bullet_fg`, `hr_fg`, `accent_fg`, `tool_name_fg`. All support `[ui.colors]` overrides.
17+
18+
See also: [[Themeable TUI Colour Scheme]], [[Ratatui UI Runtime]], [[UI Event Routing and Plain Fallback]]

0 commit comments

Comments
 (0)