^[control-codes
live in libghostty-vt

Private modes

DECSCNM Screen Mode

View as Markdown

Show the whole screen in reverse video: dark text on a light background.

CSI ? 5 h/l
DEC STD 070
§5.6 Set/Reset Screen Mode, p. 5-94
VT220
§4.6.12 Screen Mode (DECSCNM)
VT510
DECSCNM—Screen Mode: Light or Dark Screen

CSI ? 5 h sets reverse screen and CSI ? 5 l puts it back to normal. Reverse screen swaps the foreground and background colors of the whole display, so that a terminal showing light text on a dark background shows dark text on a light one. DEC STD 070 says the actual colors are the implementation’s to choose, and that every character rendition must still work in both modes. Normal is the default in the VT510 manual.

It is a way of showing the screen, not a change to it. The VT510 manual says DECSCNM “does not change the data in page memory”: the characters and their attributes, such as those set with SGR, stay as they were.

libghostty-vt records the mode and leaves drawing it to its host, and the terminals drawn on this site do not show it, so the cases check the mode with DECRQM, and that the cells are unchanged.

Support

TerminalVersionSupportNotes
VT220manual, 2nd ed., 1984Yes§4.6.12 Screen Mode (DECSCNM)
VT510manual, 1st ed., 1993YesDECSCNM
xtermpatch 412, xterm-411aYes
libghostty-vt0f171f6Yesrecords the mode and leaves drawing it to the host
kitty0.49.1, run in a VMYespasses the 3 cases that show it working
foot1.28.0, run in a VMYespasses the 2 cases that show it working
pyte0.8.2, run as a libraryNofails the case that shows it working
xterm.js headless6.0.0, run as a libraryNofails the 3 cases that show it working
alacritty_terminal0.26.0, run as a libraryNofails the 3 cases that show it working
ConEmubuild 230724, its documentationNonot in ConEmu’s list, ANSI escape codes
rxvt-unicode9.31, run in a VMYespasses the 3 cases that show it working
VTE0.84.1, run as a libraryYespasses the 2 cases that show it working

Validation

DECSCNM-1: Set, and the cells are unchanged

AB
\e[?5h
\e[?5$p   # DECRQM: is mode 5 set?
|AB___|
attr 1,1 plain
reply \e[?5;1$y

DECSCNM-2: Reset

\e[?5h
\e[?5l
\e[?5$p
|_____|
reply \e[?5;2$y

DECSCNM-3: Normal to begin with

\e[?5$p
|_____|
reply \e[?5;2$y
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.