Skip to content

Environment Variables

Silvery reads SILVERY_* environment variables at startup for verification, debugging, diagnostics, and configuration. None are required for normal operation.

Verification

These variables enable automatic correctness checking. They add overhead and are intended for development and CI, not production.

SILVERY_STRICT

Buffer-level verification that incremental rendering matches a fresh render.

Values1, true to enable; 0, false, or unset to disable
DefaultDisabled

After every frame, re-renders the entire tree from scratch and compares cell-by-cell against the incremental result. Throws IncrementalRenderMismatchError on any difference. This is the primary invariant check for the render pipeline.

bash
SILVERY_STRICT=1 bun run app

SILVERY_STRICT_TERMINAL

ANSI-level verification via terminal emulator backends. Replays the ANSI output through one or more terminal emulators and compares the resulting screen against the buffer.

Valuesvt100, xterm, ghostty, all, or a comma-separated list (e.g. vt100,xterm)
DefaultDisabled (empty string)
  • vt100 — fast internal parser (stateless)
  • xterm — xterm.js emulator (stateful, higher fidelity)
  • ghostty — Ghostty terminal emulator (stateful)
  • all — equivalent to vt100,xterm,ghostty
bash
SILVERY_STRICT_TERMINAL=vt100 bun run app
SILVERY_STRICT_TERMINAL=all bun run app

SILVERY_STRICT_ACCUMULATE

Replays ALL frames from the start on every render to catch compounding errors. O(N^2) cost.

Values1, true to enable; 0, false, or unset to disable
DefaultDisabled

Separate from SILVERY_STRICT — opt-in only because of the quadratic cost. Catches errors that only manifest after many incremental renders accumulate small drifts.

bash
SILVERY_STRICT_ACCUMULATE=1 bun run app

SILVERY_STABILITY_SKIP_LINES

Skip specific lines during stability checks in withDiagnostics(). Useful when certain lines contain non-deterministic content (timestamps, spinners).

ValuesComma-separated line numbers (0-indexed), e.g. 0,5,12
DefaultNone
bash
SILVERY_STABILITY_SKIP_LINES=0,23 bun run test

Debugging

These variables produce diagnostic output to help trace rendering issues.

SILVERY_INSTRUMENT

Enable stats collection for the render pipeline. Exposes skip/render counts, cascade depth, and scroll tier decisions.

Values1, true to enable
DefaultDisabled

Stats are available via DEBUG=silvery:content log output and programmatically on globalThis.__silvery_content_detail. Automatically enabled when SILVERY_STRICT is active.

bash
SILVERY_INSTRUMENT=1 DEBUG=silvery:content DEBUG_LOG=/tmp/silvery.log bun run app

SILVERY_CELL_DEBUG

Trace which nodes cover a specific cell position. Produces per-cell diagnostic output showing the render cascade for that coordinate.

Valuescol,row (e.g. 77,85)
DefaultDisabled

Requires DEBUG=silvery:content:cell and DEBUG_LOG to see output.

bash
SILVERY_CELL_DEBUG=77,85 DEBUG=silvery:content:cell DEBUG_LOG=/tmp/silvery.log bun run app

SILVERY_CAPTURE_OUTPUT

Capture the ANSI output written to the terminal after each frame. Appends frame-delimited output to the specified file path.

ValuesFile path (e.g. /tmp/silvery-output.ansi)
DefaultDisabled

Each frame is prefixed with a header showing the frame number and byte count.

bash
SILVERY_CAPTURE_OUTPUT=/tmp/silvery-output.ansi bun run app

SILVERY_CAPTURE_RAW

Capture raw ANSI output from the runtime diff phase to a fixed file path (/tmp/silvery-runtime-raw.ansi).

ValuesAny truthy value (e.g. 1)
DefaultDisabled

Unlike SILVERY_CAPTURE_OUTPUT (which captures scheduler output with frame headers), this captures the raw diff patches from the runtime layer.

bash
SILVERY_CAPTURE_RAW=1 bun run app

SILVERY_DEV

Enable the dev inspector for live tree inspection and diagnostics.

Values1, true to enable
DefaultDisabled
bash
SILVERY_DEV=1 bun run app

SILVERY_DEV_LOG

Set the log file path for the dev inspector. Only meaningful when SILVERY_DEV is enabled.

ValuesFile path (e.g. /tmp/silvery-dev.log)
DefaultNone (logs to default output)
bash
SILVERY_DEV=1 SILVERY_DEV_LOG=/tmp/silvery-dev.log bun run app

Configuration

These variables change runtime behavior.

SILVERY_ENGINE

Select the layout engine. Silvery ships with two layout backends.

Valuesflexily (default), yoga
Defaultflexily

Flexily is a zero-allocation Yoga-compatible flexbox engine written in TypeScript. Yoga is the original C++ engine via WASM. Both produce identical layouts for supported properties.

bash
SILVERY_ENGINE=yoga bun run app

SILVERY_SYNC_UPDATE

Force synchronous terminal output updates by wrapping output in DCS synchronized update sequences.

Values1, true to enable
DefaultDisabled

Prevents tearing on terminals that support synchronized output. Currently disabled by default due to a Ghostty rendering bug with incremental diff output.

bash
SILVERY_SYNC_UPDATE=1 bun run app

SILVERY_BG_CONFLICT

Control how background color conflicts are handled when a Text node has both an explicit background and an inherited background from an ancestor Box.

Valuesthrow (default), warn, ignore
Defaultthrow
  • throw — fail fast on programming errors (recommended)
  • warn — log a warning but continue
  • ignore — silently ignore conflicts
bash
SILVERY_BG_CONFLICT=warn bun run app

SILVERY_NO_INCREMENTAL

Disable incremental rendering entirely. Every frame performs a full fresh render.

Values1 to disable incremental rendering
DefaultDisabled (incremental rendering is on)

Useful for isolating whether a bug is in the incremental rendering logic or in the base pipeline.

bash
SILVERY_NO_INCREMENTAL=1 bun run app

SILVERY_NO_TEXT_CACHE

Disable the text measurement cache. Forces re-measurement of every text node on every render.

ValuesAny truthy value (e.g. 1)
DefaultDisabled (cache is on)

Useful for benchmarking the cache's performance impact or debugging stale measurement issues.

bash
SILVERY_NO_TEXT_CACHE=1 bun run app

SILVERY_NONTTY

Override the non-TTY rendering mode. Used in examples to test non-interactive output modes.

Valuesauto, tty, line-by-line, static, plain
Defaultauto
bash
SILVERY_NONTTY=plain bun run examples/inline/inline-nontty.tsx

SILVERY_THEME

Override the color theme by name. Used by the examples viewer to switch palettes.

ValuesAny built-in palette name (e.g. catppuccin-mocha, dracula, tokyo-night)
DefaultAuto-detected from terminal
bash
SILVERY_THEME=catppuccin-mocha bun run examples/banner.tsx

Quick Reference

VariablePurposeCategory
SILVERY_STRICTIncremental vs fresh render checkVerification
SILVERY_STRICT_TERMINALANSI output via terminal emulatorsVerification
SILVERY_STRICT_ACCUMULATEReplay all frames (O(N^2))Verification
SILVERY_STABILITY_SKIP_LINESSkip lines in stability checksVerification
SILVERY_INSTRUMENTRender pipeline statsDebugging
SILVERY_CELL_DEBUGPer-cell render traceDebugging
SILVERY_CAPTURE_OUTPUTCapture ANSI frames to fileDebugging
SILVERY_CAPTURE_RAWCapture raw diff patches to fileDebugging
SILVERY_DEVDev inspectorDebugging
SILVERY_DEV_LOGDev inspector log fileDebugging
SILVERY_ENGINELayout engine selectionConfiguration
SILVERY_SYNC_UPDATESynchronized terminal outputConfiguration
SILVERY_BG_CONFLICTBackground conflict handlingConfiguration
SILVERY_NO_INCREMENTALDisable incremental renderingConfiguration
SILVERY_NO_TEXT_CACHEDisable text measurement cacheConfiguration
SILVERY_NONTTYNon-TTY rendering modeConfiguration
SILVERY_THEMETheme overrideConfiguration