Skip to content

Screenshots

screenshot captures the current terminal viewport as an SVG vector image, a PNG raster image, or plain text (when no output file path is supplied).

The file extension selects .svg or .png output. Highlighted locators remain visible in the rendered image, which makes screenshots useful both for documentation and for visual test verification.

await terminal.getByText("Save").highlight();
await terminal.screenshot("screen.svg");
await terminal.screenshot("screen.png", {
full: true,
zoom: 2,
transparent: true,
});
Option CLI flag Behavior
Output path PATH or -o PATH Selects .svg or .png. Omitting the path returns plain text without writing a file.
Full scrollback --full Renders all retained scrollback rows plus the live screen instead of only the active viewport.
Zoom scale --zoom N Multiplies output dimensions by N (requires an output path).
Canvas background --background COLOR Overrides the outer canvas color around the terminal window (mutually exclusive with --transparent).
Transparent canvas --transparent Makes the outer canvas transparent while keeping the terminal background intact.

In Rust, PNG output requires the recording-raster Cargo feature (or one of the recording-font-jetbrains-mono* features to bundle fonts instead of relying on system fonts). Prebuilt CLI binaries and Go, Python, and JavaScript packages include PNG raster rendering and bundled fonts out of the box.

Fonts, terminal padding, window title bars, traffic-light buttons, borders, and drop shadows come from the session’s render style ([recording.style] in tui-test.toml, or style in JavaScript, Python, Go, and Rust launch options). Screenshots always draw an otherwise-visible cursor in its visible phase so captures remain deterministic even when cursor blinking is enabled. See configuration for all style fields.