Repository navigation
Description
Summary
Changing a named terminal color from red to teal produces different HTML and immutable appearance state. The boxed golden still says the screen is unchanged.
Motivation
Theme changes use OSC 4 without repainting individual cells. A visual assertion using only the symbolic color tokens cannot distinguish two different displayed colors.
From the tagged libvt checkout, install the locked development dependencies with uv sync --frozen --python 3.14 --all-groups --all-extras. Use the checkout root as the working directory.
Save the following as case.py at the checkout root and run uv run --no-sync python case.py.
from libvt import Terminal
from libvt.terminal import OutputFormat
from libvt.testing import serialize_vt_snapshot, vt_screen
terminal = Terminal(rows=1, cols=6)
terminal.feed(b"\x1b[31mBOARD")
original = terminal.committed
terminal.feed(b"\x1b]4;1;#16b3cd\x07")
new = terminal.committed
assert original.appearance != new.appearance
assert original.format(OutputFormat.HTML) != new.format(OutputFormat.HTML)
print("token golden equal", serialize_vt_snapshot(original) == serialize_vt_snapshot(new))
print("visual diff", serialize_vt_snapshot(vt_screen(new, diff=original)))Evidence
libvt v0.0.1a4 and trunk 0864aa2, CPython 3.14.6, Linux ARM64 on WSL2.
Observed output
token golden equal True
visual diff (unchanged)
Proposal
Offer a selectable appearance check for committed default colors and palette overrides, or document a concise assertion of the resolved colors alongside the golden.
- Developer experience — Theme tests can express visual intent without hand-comparing palette state separately for every snapshot.
- Immediate benefit — An OSC 4-only update supplies an immediate regression case and a corresponding OSC 104 reset control.
- Longer-term benefit — Stable symbolic snapshots and tests of user-visible theme rendering can coexist.
- End-user experience — A theme regression that makes a team’s warning color unreadable can be caught before release.
References
- src/libvt/testing.py on v0.0.1a4, line 503
- src/libvt/style.py on v0.0.1a4, line 246
- src/libvt/terminal.py on v0.0.1a4, line 2175
- Support
OSC 4/10–12queries,XTMODKEYS,?1007, and pixel?1016/?2048 - Track committed
Appearanceacross?2026holds andset_theme() - Add boxed VT + SGR snapshot serialization in libvt.testing and syrupy adapter
Activity
tony commentedon Dec 3, 2026
The guide shows how to compare an effective color through the committed snapshot's palette. The
fg=redcell resolves to (205, 0, 0), then (22, 179, 205) after the override, and back after reset. The retained middle snapshot keeps its color. PR #190