Repository navigation
feat(chat): add theme-aware Markdown colors - #4262
nicolasmendonca wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
|
This is a feature that I really wanted and implemented in my own fork of this repo. Colors in the markdown chat renderer really help me set visual cues and make it a bit easier to read long responses or plans from my agents. Just sharing it here in case you have the same opinion. Perhaps it could be a setting in the UI that can enable markdown colors or not. Some screenshots for demo: Codex — darkCatppuccin — darkCodex — light |
## Change Add a theme-like **Chat Markdown** preset picker under **Settings → Appearance** (right below the Theme card strip) so assistant Markdown replies can use theme-aware typography and color presets instead of a single monochrome style or a binary toggle. Four presets are selectable from a miniature-preview card strip (`role="radiogroup"`, arrow/Home/End navigation, reset button), defaulting to **`Editorial`**: - **Editorial** (`editorial`, default) — restrained Claude/Linear-style hierarchy: neutral strong headings with a hairline divider under `h2`, subtle single-accent tints on list markers, blockquote rail/wash, and non-file inline code pills, plus an elevated table header. - **Tinted** (`tinted`) — soft two-tone theme tint across headings, blockquotes, and inline code. - **Colorful** (`colorful`) — syntax-colored Markdown roles driven by the active theme's `--syntax-*` tokens (building on the direction proposed in #4262). - **Plain** (`plain`) — preserves the original monochrome Markdown rendering unchanged. ### Key details - **Scoped to assistant replies only** (`.chat-turn-agent .markdown`): user bubbles, file previews, fenced code syntax highlighting, and clickable file/link chips (`.markdown-file`, `.markdown-code-link`, `a > code`) keep their existing affordances and hover/focus states. - **Zero-FOUC boot & safe storage**: persisted under its own `ovis:markdown-style` key (read in `src/theme-bootstrap.ts` before React mounts, synced across tabs via `StorageEvent`, and never clobbered by older tabs rewriting `ovis:settings`). - **Cross-device sync**: added `"markdownStyle"` to `SHARED_SETTING_KEYS` in `shared/preferences.ts`. - **Theme token & contrast safety**: 100% existing CSS tokens and `color-mix()` (no color literals or `!important`), with automated WCAG AA (`>= 4.5:1`) contrast tests covering all 25 built-in dark and light themes across `editorial`, `tinted`, and `colorful` (`src/lib/themes.contrast.test.ts`). - **i18n, docs & changelog**: added Korean, Japanese, and Simplified Chinese settings translations, documented `markdownStyle` in `DESIGN.md`, and added `changelog.d/chat-markdown-styles.md`. ### Screenshots (real Ovis demo, 1280px dark & light) #### Settings → Appearance → Chat Markdown | Dark | Light | | --- | --- | |  |  | #### Editorial (default) | Dark | Light | | --- | --- | |  |  | #### Tinted | Dark | Light | | --- | --- | |  |  | #### Colorful | Dark | Light | | --- | --- | |  |  | #### Plain (before / monochrome baseline) | Dark | Light | | --- | --- | |  |  | ## Validation - `bun run check fast`: **pass** (`workflow syntax`, `generate:types --check`, `generate:themes --check`, `typecheck`, `build`, and `unit`: 28,771 pass, 0 fail, 259 skip across 1,349 files). - Includes new WCAG AA (`>= 4.5:1`) contrast assertions across all 25 built-in themes × all styled presets in `src/lib/themes.contrast.test.ts`, storage/scope/legacy-tab survival tests in `src/lib/settings.test.ts`, and cold-boot parity in `src/lib/themeBoot.test.ts`. - Built demo browser verification (`1280px` dark & light): verified default `data-markdown-style="editorial"`, live switching across all 4 cards, `localStorage["ovis:markdown-style"]` persistence across reload, and clickable file chip preservation. - Skipped locally: `bun run test:integration` / `bun run test:ui` (covered by CI).
|
Thank you for proposing and building this, @nicolasmendonca! We really liked the idea of theme-aware Markdown styling in Chat, and after reviewing it we expanded the direction into a 4-preset picker under Settings → Appearance → Chat Markdown ( Closing #4262 in favor of #4821 (with credit there). Thanks again for sparking this! |



Summary
Theme-aware colors for assistant chat Markdown using existing theme tokens. Only ChatView.css and a changelog fragment; no preview scripts, Markdown examples or screenshot assets. Prose remains neutral; parser, palettes and fenced-code highlighting are unchanged.
Validation
Build, typecheck, freshness and workflow checks passed; 150 targeted tests and 25 real-client visual variants passed. Independent diff review passed. Full check fast failed in unit tests in this environment; one cache failure was reproduced on clean upstream, but remaining failures are not all baseline-classified. Native/integration lanes were not run.
Demo
Representative screenshots (same CSS rules; assets outside this diff): nicolasmendonca#1 (comment)