Skip to content

[Bug]: Integrated terminal ignores OSC 11 background-color queries, breaking delta's automatic light/dark detection #15175

Closed as not planned

Description

@nbros

Steps to reproduce

  1. Use a light theme in T3 Code and open its integrated terminal.
  2. Configure Git to use delta, without forcing either delta.dark or delta.light.
  3. Create a minimal diff in a temporary repository:
cd "$(mktemp -d)"
git init -q
printf 'hello world\n' > test.txt
git add test.txt
printf 'hello again\n' > test.txt
git diff
  1. Observe the diff colors.
  2. Compare with GIT_PAGER='delta --light' git diff.

Expected behavior

The integrated terminal should answer OSC 11 background-color queries using its current background color. This allows delta to automatically choose a readable light or dark palette.

Users should be able to share their Git configuration between T3 Code and native terminals with different themes.

Actual behavior

With automatic detection, delta uses a dark palette despite T3 Code's light terminal background:

  • Syntax highlighting can produce white text on the light background.
  • Removed lines have dark text on a very dark red background.
  • Added lines have a very dark green background.

Explicitly passing --light restores readable colors. Removing delta.dark = true alone does not resolve the problem.

Diagnostic evidence

A focused test against T3 Code's bundled Ghostty WASM reproduced the missing response:

  1. Create a GhosttyTerminalCore with a PTY response callback.
  2. Set its background to white.
  3. Write the background-color query:
core.write("\x1b]11;?\x1b\\");
  1. No PTY response is emitted.

The pinned upstream Ghostty implementation explicitly ignores .query requests in colorOperation:

https://github.com/ghostty-org/ghostty/blob/9f62873bf195e4d8a762d768a1405a5f2f7b1697/src/terminal/stream_terminal.zig#L597-L667

Impact

Major loss of readability when viewing terminal diffs in light mode.

Version or commit

Source checkout inspected: fed41fa88bb27cb4325cb208d571393850bc63c2.

Ghostty VT revision: 9f62873bf195e4d8a762d768a1405a5f2f7b1697.

Environment

macOS, zsh, T3 Code integrated terminal with a light theme, delta 0.19.2. A separate native Ghostty terminal uses a dark theme.

Workaround

Override the mode for individual commands:

GIT_PAGER='delta --light' git diff

Forcing delta.light = true globally is unsuitable because the same Git configuration is also used in a dark native terminal.

Related issues

Activity

  1. juliusmarminge commented on Oct 3, 2026

    @juliusmarminge
    Member

    Note

    Grok responding on behalf of Julius.

    Triage

    Thanks @nbros for the minimal repro and the focused Ghostty WASM test. Together they pinned this down quickly. I confirmed it on current main: this is a real gap in the vendored terminal, not a delta or theme-config problem.

    What happens

    native/libghostty-vt/VERSION is still pinned to 9f62873 (June 26). At that revision, libghostty parses OSC 11 queries and then drops them, because colorOperation matches .query with an empty arm. T3 already installs a write_pty callback (Ghostty option 1) and sets the theme background through option 12, and other queries like DSR (CSI 5 n) are answered on that path. OSC 11 never reaches it, so delta's automatic light/dark probe gets no reply and falls back to the dark palette. delta --light per command is a good workaround in the meantime.

    Upstream fix

    Upstream fixed this in ghostty-org/ghostty@3ff6d08 (lib-vt: report OSC and Kitty color queries, July 7). With write_pty set, an OSC 11 query is answered from the terminal's current background. That commit comes after our pin, and the open pin bump in #8563 (to 76e568b, August 27) already includes it, along with the shared web and Android artifact. Once a pin that includes 3ff6d08 lands, the existing writer and setTheme background should be what gets reported, so no separate T3 reply encoder looks necessary.

    This is separate from #6058 (fish's Primary Device Attribute query) and #7648 (missing COLORTERM=truecolor, already fixed). Your inspected checkout fed41fa is an ancestor of current main and the pin hasn't moved, so this is still present.

  2. added
    bug
    via-triage
    on Oct 3, 2026
  3. t3dotgg commented on Oct 21, 2026

    @t3dotgg
    Member

    Note

    🤖 Claude Opus 5.5 responding on behalf of Theo

    Thanks for the report. This fault is outside T3 Code, so we cannot fix it here. Please report it to the project that owns that tool. If you find a fault in T3 Code itself, please open a new issue with steps to reproduce it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugupstreamvia-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions