Add 0.5px overlap to background rects for sub-pixel gap elimination

Background rects now extend 0.5px in both width and height to create
a slight overlap, eliminating visible sub-pixel gaps when viewing
SVG screenshots at high zoom levels.
This commit is contained in:
GitHub Copilot
2026-01-24 19:59:37 +00:00
parent 1f5e5c2c31
commit 3701a3df31
4 changed files with 7 additions and 6 deletions
+3 -2
View File
@@ -207,11 +207,12 @@ def render_terminal_svg(
char_cols = 2 # Wide character
# Background rect if not default
# Add 0.5px overlap in both directions to eliminate sub-pixel gaps at high zoom
if bg != background:
bg_width = char_cols * char_width
bg_width = char_cols * char_width + 0.5
row_bg_rects.append(
f'<rect x="{x:.1f}" y="{rect_y:.1f}" '
f'width="{bg_width:.1f}" height="{actual_line_height:.1f}" '
f'width="{bg_width:.1f}" height="{actual_line_height + 0.5:.1f}" '
f'fill="{bg}"/>'
)