feat: render screenshots using session theme palettes

Pass per-theme background, foreground, and 16-color palettes into the SVG
exporter so screenshots match the active session theme (including ANSI colors).

Adds theme palette mappings and updates screenshot tests to validate themed
backgrounds and palette-aware color conversion.
This commit is contained in:
GitHub Copilot
2026-01-29 22:40:27 +00:00
parent 3b3246bbd0
commit 7b215beb2a
4 changed files with 336 additions and 8 deletions
+9
View File
@@ -183,6 +183,14 @@ class TestLocalServerHelpers:
screen_buffer = screen_buffer_factory(["hello", ""])
mock_session.get_screen_snapshot = AsyncMock(return_value=(80, 2, screen_buffer, True))
server.session_manager.apps_by_slug["rk"] = App(
name="Test",
slug="rk",
path="./",
command="echo test",
terminal=True,
theme="dracula",
)
monkeypatch.setattr(
server.session_manager, "get_session_by_route_key", lambda _rk: mock_session
@@ -191,6 +199,7 @@ class TestLocalServerHelpers:
response = await server._handle_screenshot(request)
assert response.content_type == "image/svg+xml"
assert "<svg" in response.text
assert "#282a36" in response.text
out = capsys.readouterr()
assert out.out == ""