Repository navigation
Conversation
Answers the CSI ?996n Device Status Report (used by modern CLIs to detect a terminal's light/dark preference) with CSI ?997;<n>n instead of leaving it as an unsupported DEC-specific DSR. Terminal.getColorMode() defaults to UNKNOWN; JediTerminal.setColorMode() lets the embedding app report its actual theme.
ghosthack
force-pushed
the
upstream-pr/dsr-996-color-mode
branch
from
October 10, 2026 21:17
8ee41a8 to
e643bd2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Several modern terminal emulators (Ghostty, Contour, foot) implement a VT
extension where a program queries the host terminal's light/dark color
preference with
CSI ?996nand gets backCSI ?997;<n>n(0=unknown,1=light, 2=dark). Some CLIs now send this to pick their own theme.
JediTerm currently treats this as an unrecognized DEC-specific Device
Status Report and silently drops it (
Don't support DEC-specific Device Report Status), so the querying program never gets an answer.This adds support for it:
Terminal.getColorMode()— new default method, returnsUNKNOWNunless overriddenTerminalColorMode— new enum (UNKNOWN/LIGHT/DARK) carrying the reply codeJediTerminal.setColorMode(...)— lets the embedding application report its actual themeJediEmulatoranswersCSI ?996nwithCSI ?997;<code>ninstead of warning and dropping itAlso improved the existing warning for any other unrecognized
DEC-specific DSR to include
ControlSequence.getDebugInfo()(parsed argsESC[...]sequence) instead of a generic message, which is how Ifound the
?996ncase in the first place — useful for diagnosing futureunsupported sequences without needing DEBUG-level logging enabled.
Fully additive/backwards compatible — no existing method signatures changed,
getColorMode()is a default method,getColorMode/setColorModeonly apply if the embedder opts in.Test plan
./gradlew :core:compileJava :core:compileKotlinagainst currentmasterCSI ?996n, confirmed the correctCSI ?997;<n>nreply is now sent based on the embedding app's reported color mode