Skip to content

Background color query (OSC 11)

Category: extensions · Baseline: modern · Tags: Operating System Commands (OSC), Xterm Extensions · Specification ↗

ESC ] 11 ; ? BEL
OSC 11 queries the terminal's default background color. The query is ESC ] 11 ; ? ST. The response format matches OSC 10. This is the most reliable way to detect whether the user has a dark or light terminal theme — compare the background color's luminance to determine the appropriate color palette.
How this is testedautomated
Query background color with OSC 11 ; ? BEL, verify response matches OSC 11 ; rgb:... pattern via feedCapture.

The same probe runs against headless backends (via Termless) and real terminal apps (via a daemon launched in each terminal). This lets us distinguish parser correctness from rendering correctness.

Analysis2026-04-06

Supported by 10 of 12 terminals (83%). Not supported by: vt100.js, xterm.js. Part of the Modern TUI baseline. Notes: vt100.js: Not implemented — pure TypeScript emulator; xterm.js: OSC 11 background color query not implemented in xterm.js.

Supported by 7 of 14 backends (50%)

Terminal Applications

TerminalVersionSupportNotes
iTerm23.6.9✓ yes
Ghostty1.3.1✓ yes
VS Code✓ yes
Warp✓ yes
Cursor✓ yes
Terminal.app✓ yes

Headless Backends

Parser correctness only — a means the parser accepts the sequence.

BackendVersionSupportNotes
vterm0.2.0✓ yes
Alacritty0.26.0~ partialOSC 11 color query not exposed in headless mode
Kitty0.40.0~ partialOSC 11 color query not exposed via Python batch bridge
WezTerm0.1.0-fork.5~ partialOSC 11 color query not exposed in headless mode
vt100.js0.2.1✗ noNot implemented — pure TypeScript emulator
xterm.js5.5.0✗ noOSC 11 background color query not implemented in xterm.js