Skip to content

feat(native-chat): add appearance settings for Chat UI (font, size, line height, theme) - #21032

Closed
denis-sj wants to merge 1 commit into
stablyai:mainfrom
denis-sj:feat/chat-appearance-settings-20392
Closed

denis-sj wants to merge 1 commit into
stablyai:mainfrom
denis-sj:feat/chat-appearance-settings-20392

Conversation

@denis-sj

Copy link
Copy Markdown
Contributor

Why

Every other reading/editing surface in Orca (terminal, Monaco editor, left sidebar) exposes dedicated appearance controls. The native chat UI had none — font, size, line height, and monospace stack were all hard-coded Tailwind classes. The only workaround was application-wide window zoom, which enlarged unrelated UI chrome.

Summary

New settings fields (GlobalSettings)

chatAppearanceMode ('default' | 'match-terminal'), chatFontFamily, chatFontSize (9–32 px, default 13), chatLineHeight (1.0–2.5, default 1.4), chatFontMono.

CSS variable infrastructure

.native-chat-surface class publishes --chat-font-size, --chat-line-height, --chat-font-family and remaps every fixed Tailwind text size (.text-sm, .text-xs, .text-[11px], .text-[10px]) proportionally via calc(var(--chat-font-size) * ratio) so visual balance is maintained at any font size.

Terminal theme matching

chatAppearanceMode: 'match-terminal' invokes resolveTerminalSurfaceVariables() (shared with the left sidebar) to project terminal background, foreground, card, accent, muted, and border colors onto the chat surface.

Settings UI (Settings → Appearance → Chat)

  • Chat Theme segmented control (Follow App / Match Terminal)
  • Font Family autocomplete
  • Font Size stepper (9–32 px)
  • Line Height stepper (1.0–2.5)
  • Monospace Font autocomplete
  • All entries indexed in the settings search palette

Documentation

docs/site/content/docs/agents/native-chat.mdx — new ## Appearance section.

Tests

58 / 58 tests pass across 4 suites:

  • ChatAppearanceSection.test.tsx — 8
  • use-native-chat-appearance-style.test.ts — 12
  • AppearancePane.test.tsx — 26
  • NativeChatStructuredSession.test.tsx — 12

oxlint — 0 warnings, 0 errors.

Issue Number

Fixes #20392

@coderabbitai

coderabbitai Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

📝 Walkthrough

Walkthrough

Adds Chat Appearance settings for theme, font family, font size, line height, and monospace font. The settings receive defaults and normalization before persistence. A new Appearance section provides controls, search entries, summaries, and deep-link support. Native chat views apply computed CSS variables for typography and optional terminal surface colors. Tests cover the controls, normalization-related styling, and appearance section behavior. Documentation describes the new settings.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: 🔵 Low · up to 4f519

Users may be unable to type a replacement font size normally, and screen-reader users cannot identify the font-size controls. These are bounded settings usability issues.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the purpose, implementation, settings, linked issue, and automated tests. It omits several required template sections, including visual proof for this UI change, manual testin… Complete the required description sections. Attach before-and-after visual proof, or provide the required N/A explanation only if there is no visual or interaction change. Add manual test status, tested platforms, applicable AI disclosure, …
Docstring Coverage ⚠️ Warning Docstring coverage is 13.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 19 files. (2 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the native Chat UI appearance settings, including font, size, line height, and theme changes.
Linked Issues check ✅ Passed Issue #20392 requires chat-specific font family, base font size, line height, monospace font, theme matching, global persistence, CSS-variable exposure, Appearance placement, search integration, and d…
Out of Scope Changes check ✅ Passed The changed files implement issue #20392. The shared normalization, terminal-variable export, chat surface styling, settings UI, search integration, documentation, and tests directly support the reque…
Full details: Description check

Explanation

The description explains the purpose, implementation, settings, linked issue, and automated tests. It omits several required template sections, including visual proof for this UI change, manual testing details and platform coverage, review notes, the checklist, and other applicable declarations.

Resolution

Complete the required description sections. Attach before-and-after visual proof, or provide the required N/A explanation only if there is no visual or interaction change. Add manual test status, tested platforms, applicable AI disclosure, review notes, cross-platform and compatibility considerations, and checklist results.

Full details: Docstring Coverage

Explanation

Docstring coverage is 13.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 19 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch feat/chat-appearance-settings-20392

Warning

⚠️ This pull request shows signs of AI-generated slop (description_diff_mismatch). It has been flagged by CodeRabbit slop detection and should be reviewed carefully.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 1f944c59-2a2f-40d0-9a1f-375cd3ed3661

📥 Commits

Reviewing files that changed from the base of the PR and between 291b4dd and 4f5191e.

📒 Files selected for processing (21)
  • docs/site/content/docs/agents/native-chat.mdx
  • src/main/persistence/applying-settings/settings-update.ts
  • src/renderer/src/assets/main.css
  • src/renderer/src/components/native-chat/NativeChatResolvedView.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx
  • src/renderer/src/components/native-chat/NativeChatView.tsx
  • src/renderer/src/components/native-chat/use-native-chat-appearance-style.test.ts
  • src/renderer/src/components/native-chat/use-native-chat-appearance-style.ts
  • src/renderer/src/components/settings/AppearancePane.test.tsx
  • src/renderer/src/components/settings/AppearancePane.tsx
  • src/renderer/src/components/settings/ChatAppearanceSection.test.tsx
  • src/renderer/src/components/settings/ChatAppearanceSection.tsx
  • src/renderer/src/components/settings/appearance-chat-search.ts
  • src/renderer/src/components/settings/appearance-search.ts
  • src/renderer/src/lib/left-sidebar-appearance.ts
  • src/renderer/src/store/slices/settings.ts
  • src/renderer/src/store/slices/ui/ui-slice-contract-contextual.ts
  • src/shared/chat-appearance-settings.ts
  • src/shared/default-global-settings.ts
  • src/shared/global-settings-types.ts
  • src/shared/ui-chrome-types.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.

)}
control={
<div className="flex items-center gap-2">
<Button

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '115,190p' src/renderer/src/components/settings/ChatAppearanceSection.tsx
sed -n '45,85p' src/renderer/src/components/settings/SettingsFormControls.tsx
rg -n 'function Button|const Button|aria-label|aria-labelledby' src/renderer/src/components/ui src/renderer/src/components/settings/SettingsFormControls.tsx

Repository: stablyai/orca

Length of output: 5871


🏁 Script executed:

sed -n '1,75p' src/renderer/src/components/settings/ChatAppearanceSection.tsx
sed -n '1,130p' src/renderer/src/components/ui/button.tsx
fd -i 'input.tsx' src/renderer/src/components
fd -i 'label.tsx' src/renderer/src/components

Repository: stablyai/orca

Length of output: 5743


🏁 Script executed:

sed -n '1,100p' src/renderer/src/components/ui/input.tsx
sed -n '1,100p' src/renderer/src/components/ui/label.tsx
sed -n '1,180p' src/renderer/src/components/settings/SearchableSetting.tsx

Repository: stablyai/orca

Length of output: 2672


Add accessible names to the font-size controls.

SettingsRow renders a sibling Label, and SearchableSetting does not render another label. The numeric Input therefore has no accessible name. The decrease and increase Button elements contain only icons, so screen readers cannot identify their actions. Add localized aria-label values such as “Decrease font size”, “Font size”, and “Increase font size”, or explicitly associate the input with the label.

Comment on lines +157 to +166
onChange={(e) => {
const value = Number.parseInt(e.target.value, 10)
if (
!Number.isNaN(value) &&
value >= MIN_CHAT_FONT_SIZE &&
value <= MAX_CHAT_FONT_SIZE
) {
updateSettings({ chatFontSize: value })
}
}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Keep a draft value until font-size commit.

The controlled input rejects invalid intermediate values on every keystroke. For example, replacing 13 with 20 first produces 2, which is rejected and restores 13.

Keep local draft state. Clamp and persist on blur or Enter.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Two blocking localization CI gates fail on this branch. verify:localization-catalog and verify:localization-extraction both report every new auto.components.settings.ChatAppearanceSection.* / AppearancePane.chat* key as missing from src/renderer/src/i18n/locales/en.json, which this PR does not touch. Runtime is unaffected (i18n falls back to the inline English defaults), but the required checks cannot go green until the catalog is regenerated.

Reviewed changes

  • New settings fields — chatAppearanceMode, chatFontFamily, chatFontSize, chatLineHeight, chatFontMono on GlobalSettings, with defaults and shared normalizeChat* / applyChatSettingsNormalizations applied at both the main and renderer settings boundaries.
  • CSS variable surface — .native-chat-surface in main.css publishes --chat-font-size / --chat-line-height / --chat-font-family and proportionally remaps .text-sm, .text-xs, .text-[11px], .text-[10px], and .leading-relaxed.
  • useNativeChatAppearanceStyle — memoized inline CSS vars, terminal-font fallback for mono, and reuse of the now-exported resolveTerminalSurfaceVariables for match-terminal.
  • Settings UI — new ChatAppearanceSection under Settings → Appearance → Chat, wired into AppearancePane (new chat section key + summary), the deep-link union, and the settings search catalog.
  • Docs — native-chat.mdx gains an ## Appearance section.

⚠️ New localization keys are missing from en.json, failing two required gates

Every new translate(...) call in AppearancePane.tsx, ChatAppearanceSection.tsx, and appearance-chat-search.ts introduces a key that is not in src/renderer/src/i18n/locales/en.json, and this PR does not update that file. The verifier treats a missing key as an error, so both the catalog and extraction gates exit 1; they are blocking steps in .github/workflows/pr.yml and in the root pnpm lint chain.

Technical details
# New translate() keys absent from en.json

## Affected sites
- `src/renderer/src/components/settings/AppearancePane.tsx:127,217,221,222` — `AppearancePane.chatTitle`, `.chatDefaultFont`, `.chatMatchTerminalMode`, `.chatDefaultMode`
- `src/renderer/src/components/settings/ChatAppearanceSection.tsx:48-238` — 11 `ChatAppearanceSection.*` keys
- `src/renderer/src/components/settings/appearance-chat-search.ts:9-146` — 20+ `ChatAppearanceSection.*` keys
- `src/renderer/src/i18n/locales/en.json` — unchanged by this PR, so `flattenCatalogKeys(en)` has none of the above

## Evidence (this branch, vs merge-base `f2d5711`)
- `node config/scripts/verify-localization-catalog.mjs` → exit 1: "Localization keys are missing from src/renderer/src/i18n/locales/en.json."
- `node config/scripts/verify-localization-extraction.mjs` → exit 1: "Extracted keys missing from en.json: auto.components.settings.ChatAppearanceSection…"
- `verify:localization-runtime-catalog` and `verify:localization-coverage` pass, and `check:code-quality:changed` passes.

## Required outcome
- `en.json` contains every new key with its English fallback so both gates pass.

## Suggested approach
- `pnpm run sync:localization-catalog` bootstraps the entries from the inline fallbacks, then re-run `pnpm run verify:localization-extraction`.
- `fontFamilyTitle`, `fontSizeTitle`, `lineHeightTitle`, and `fontMonoTitle` are used with different fallback text in `ChatAppearanceSection.tsx` and `appearance-chat-search.ts`; the bootstrap keeps only the first-seen value, so align the fallbacks or give the search-catalog entries their own keys.
</details>

### ℹ️ Nitpicks

- `default-global-settings.ts:50-54` and `AppearancePane.tsx:218` hardcode `13` / `1.4` / `'default'` instead of the `DEFAULT_CHAT_*` constants this PR just added, inviting drift.
- The PR description lists the ranges as 9–32 px and 1.0–2.5, but the code and docs both ship 10–24 px and 1.0–3.0.
- `useNativeChatAppearanceStyle` is called and `.native-chat-surface` + `style` applied in `NativeChatView`, `NativeChatResolvedView`, and `NativeChatStructuredSession`; the inner applications are redundant in the production tree (they only matter for direct renders/tests).
- `appearanceAccordionDeepLink` now accepts `'chat'`, but nothing sets it, and the deep-link effect always scrolls to `USAGE_PERCENTAGE_DISPLAY_SETTING_ID`, so a `'chat'` link would reveal the section at the wrong scroll target.
- The new `normalizeChat*` / `applyChatSettingsNormalizations` logic has no unit tests, unlike the sibling normalizers it mirrors.

<!-- PULLFROG_DIVIDER_DO_NOT_REMOVE_PLZ -->
<sup><a href="https://pullfrog.com"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pullfrog.com/logos/frog-white-full-18px.png"><img src="https://pullfrog.com/logos/frog-green-full-18px.png" width="9px" height="9px" style="vertical-align: middle; " alt="Pullfrog"></picture></a>&nbsp;&nbsp;| [Fix all ➔](https://pullfrog.com/trigger/stablyai/orca/21032?action=fix&review_id=5222494889) | [Fix 👍s ➔](https://pullfrog.com/trigger/stablyai/orca/21032?action=fix-approved&review_id=5222494889) | [View workflow run](https://github.com/stablyai/orca/actions/runs/35093882008/job/104786387378) | Using `DeepSeek Flash` (free via [Pullfrog for OSS](https://pullfrog.com/for-oss)) | [𝕏](https://x.com/pullfrogai)</sup>

{
title: translate(
'auto.components.settings.ChatAppearanceSection.fontFamilyTitle',
'Chat Font Family'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fontFamilyTitle (and fontSizeTitle, lineHeightTitle, fontMonoTitle) is shared with ChatAppearanceSection.tsx, but the English fallbacks differ — 'Chat Font Family' here vs 'Font Family' there. sync:localization-catalog keeps only the first fallback it sees, so the settings row can silently take the search-catalog wording (or vice-versa). Align the fallback strings or give the search entries distinct keys.

@BarbiLuca

Copy link
Copy Markdown

I'd find this very useful. In dark mode the Chat UI renders #fafafa text on a #0a0a0a background, and over long agent sessions that contrast strains the eyes. There's no way to soften it today: the chat follows the app palette and only offers system, dark or light. With chatAppearanceMode: 'match-terminal' I could reuse the terminal theme, which already has a softer gray background. Related: #20392, #11452.

@AmethystLiang

Copy link
Copy Markdown
Contributor

Thanks, @denis-sj — your PR directly overlaps with the chat-font work now being carried in #33687, and we took inspiration from your implementation. To avoid duplicate review tracks, we are closing this one and will credit you as the author of the corresponding work on #33687.

@AmethystLiang

Copy link
Copy Markdown
Contributor

Reopening this: after comparing the implementations, it is not a duplicate. #33687 addresses the same font-family need through the existing nativeChatAppearance model, while this PR independently implements a broader chat-appearance system. Both can be reviewed on their own merits.

@nwparker

nwparker commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Closing this PR because the linked issue (#20392) was completed via #33687, and main now includes the full nativeChatAppearance settings suite (matchTerminalInterface, fontFamily, fontSize, codeFontSize, width, contrast, and reset) in AppearanceChatSection, leaving this branch superseded and conflicting. Thanks again for the original contribution and inspiration!

@nwparker nwparker closed this Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Appearance settings for the Chat UI (font family, size, line height, theme)

4 participants