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
+24
View File
@@ -55,6 +55,30 @@ class TestColorToHex:
"""Color conversion covers named/hex/default cases."""
assert _color_to_hex(color, is_foreground=is_foreground) == expected
def test_color_to_hex_uses_palette_defaults(self) -> None:
palette = {"red": "#123456"}
assert _color_to_hex(
"default",
is_foreground=True,
palette=palette,
default_fg="#111111",
default_bg="#222222",
) == "#111111"
assert _color_to_hex(
"default",
is_foreground=False,
palette=palette,
default_fg="#111111",
default_bg="#222222",
) == "#222222"
assert _color_to_hex(
"red",
is_foreground=True,
palette=palette,
default_fg="#111111",
default_bg="#222222",
) == "#123456"
class TestEscapeXml:
"""Tests for XML escaping."""