Skip to content

fix(theme): make graphite the explicit default across startup modes#200

Merged
benvinegar merged 1 commit intoelucid/tty-mouse-pager-fixesfrom
elucid/global-graphite-deafult
Apr 13, 2026
Merged

fix(theme): make graphite the explicit default across startup modes#200
benvinegar merged 1 commit intoelucid/tty-mouse-pager-fixesfrom
elucid/global-graphite-deafult

Conversation

@elucid
Copy link
Copy Markdown
Member

@elucid elucid commented Apr 13, 2026

Summary

Make graphite the single built-in fallback theme across startup modes, removing implicit renderer-mode-based fallback selection for unspecified themes.

This is intentionally scoped on top of elucid/tty-mouse-pager-fixes, where stdin-backed patch - / pager sessions need split terminal plumbing to preserve mouse scrolling.

Why this change

On main, piped patch/pager sessions happened to come up dark under the old all-/dev/tty renderer wiring.

On elucid/tty-mouse-pager-fixes, fixing mouse scrolling required keeping interactive input on /dev/tty while rendering through process.stdout. That change is necessary for the branch goal, but it also changes the effective renderer theme-mode signal in stdin-backed startup paths. As a result, an unspecified theme can resolve to light there even though other startup modes still resolve to graphite.

We tested the obvious alternative: reverting the stdout-side plumbing change. That does make the piped patch/pager theme dark again, but it also regresses the mouse-scroll fix that motivated the branch. So reverting the transport change is not a viable fix.

Given that constraint, the pragmatic choice is to stop treating an unspecified theme as an implicit auto-detect mode and instead make the built-in fallback explicit: graphite.

What this changes

  • Config/bootstrap resolution now defaults unspecified themes to graphite.
  • Theme fallback resolution now also defaults to graphite regardless of renderer-reported light/dark mode.
  • Explicit user and config overrides still work (--theme, theme = "paper", etc.).

In other words, Hunk no longer treats an omitted theme as an implicit terminal-following mode.

Why this is pragmatic

  • Preserves the branch's mouse-scroll behavior.
  • Removes startup-path-dependent theme drift.
  • Keeps behavior deterministic across diff, file-backed patch, stdin-backed patch -, and pager.
  • Avoids depending on a renderer-mode signal that changes under the tty plumbing required for stdin-backed interactivity.
  • Still allows explicit overrides via CLI or config.

This chooses a stable product fallback over transport-sensitive autodetect behavior.

Tradeoff

This intentionally changes the old behavior where an unspecified or unrecognized theme could fall back through renderer light/dark detection (paper on light terminals, graphite on dark terminals). After this change, Hunk always falls back to graphite unless a specific theme is requested via config or CLI.

That tradeoff is intentional. If terminal-following theme selection is something we want to preserve as a product feature, the cleaner long-term design is to make that explicit (for example with a future theme = auto / --theme auto) rather than relying on renderer startup details.

Tests

  • bun test src/core/config.test.ts src/ui/lib/ui-lib.test.ts
  • bun test test/pty/ui-integration.test.ts -t "(stdin patch mode enables mouse wheel scrolling in pager UI|general pager mode enables mouse wheel scrolling for diff-like stdin)"
  • bun run typecheck

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 13, 2026

Greptile Summary

Makes graphite the single explicit built-in theme fallback by defaulting theme to "graphite" in resolveConfiguredCliInput and removing the renderer-mode-sensitive paper branch from resolveTheme. User and config-file overrides continue to work correctly via the existing ??-based mergeOptions chain. All findings are P2.

Confidence Score: 5/5

Safe to merge; all remaining findings are non-blocking style suggestions.

The logic change is correct and well-scoped. Override precedence is preserved by the ??-based merge chain. Tests cover the new default path. Only P2 style findings remain.

No files require special attention.

Important Files Changed

Filename Overview
src/core/config.ts Sets theme: "graphite" as the explicit base default in resolveConfiguredCliInput; user/config/CLI overrides still propagate correctly via mergeOptions.
src/ui/themes.ts Removes the paper light-mode fallback branch from resolveTheme; _themeMode parameter is kept but unused — callers in App.tsx still pass it silently.
src/core/config.test.ts Adds graphite-default assertion to an existing test and a new loadAppBootstrap test; no coverage for explicit user-config override winning over the graphite default.
src/ui/lib/ui-lib.test.ts Updates resolveTheme fallback test to expect graphite instead of paper for a light-mode renderer; straightforward and correct.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[resolveConfiguredCliInput] --> B[base: theme = graphite]
    B --> C{user config file\nspecifies theme?}
    C -- yes --> D[mergeOptions: use config theme]
    C -- no --> E[keep graphite]
    D --> F{CLI --theme flag?}
    E --> F
    F -- yes --> G[mergeOptions: use CLI theme]
    F -- no --> H[keep resolved theme]
    G --> I[bootstrap.initialTheme]
    H --> I
    I --> J[resolveTheme called in App.tsx]
    J --> K{exact match\nin THEMES list?}
    K -- yes --> L[return matched theme]
    K -- no --> M[return graphite fallback\n_themeMode ignored]
Loading

Reviews (2): Last reviewed commit: "fix(theme): make graphite the explicit d..." | Re-trigger Greptile

The tty/mouse pager work depends on split stdio wiring for stdin-backed patch and pager sessions. In that path, implicit renderer theme autodetect no longer produces stable default-theme behavior. Make graphite the built-in default so startup mode no longer changes the palette while still allowing explicit user and config overrides.
@elucid elucid force-pushed the elucid/global-graphite-deafult branch from 5c36949 to 2134eca Compare April 13, 2026 02:45
@elucid
Copy link
Copy Markdown
Member Author

elucid commented Apr 13, 2026

@greptileai review

@benvinegar benvinegar merged commit f39f784 into elucid/tty-mouse-pager-fixes Apr 13, 2026
3 checks passed
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.

2 participants