@@ -92,12 +92,14 @@ func (r *Rasterizer) drawTextRunWithFace(
9292
9393 colors := r .computeTextRunColors (run , rowY , catalog )
9494
95- // Draw background rectangle for the run
96- draw .Draw (img ,
97- image .Rect (colors .x , colors .y , colors .x + colors .textWidth , colors .y + r .config .RowHeight ),
98- & image.Uniform {colors .bg },
99- image.Point {},
100- draw .Src )
95+ // Draw background rectangle only if it's not the default color
96+ if ! catalog .IsDefault (run .Attrs .BG ) {
97+ draw .Draw (img ,
98+ image .Rect (colors .x , colors .y , colors .x + colors .textWidth , colors .y + r .config .RowHeight ),
99+ & image.Uniform {colors .bg },
100+ image.Point {},
101+ draw .Src )
102+ }
101103
102104 // Draw text
103105 drawer := & font.Drawer {
@@ -160,12 +162,13 @@ func (r *Rasterizer) drawBackground(img *image.RGBA) {
160162}
161163
162164// drawTerminalBackground draws the terminal content area background.
163- // Uses the theme's Background color for the terminal content.
165+ // Uses the theme's WindowBackground color to match the window chrome,
166+ // creating a seamless appearance while maintaining full opacity for GIF performance.
164167func (r * Rasterizer ) drawTerminalBackground (img * image.RGBA , width , height int ) {
165168 contentX := r .config .Padding
166169 contentY := r .contentOffsetY ()
167- // Use theme Background for terminal content area
168- termBg := r .config .Theme .Background
170+ // Use WindowBackground to match the window chrome color
171+ termBg := r .config .Theme .WindowBackground
169172
170173 draw .Draw (img ,
171174 image .Rect (contentX , contentY , contentX + width , contentY + height ),
@@ -251,12 +254,14 @@ func (r *Rasterizer) drawTextRunToPaletted(
251254
252255 colors := r .computeTextRunColors (run , rowY , catalog )
253256
254- // Draw background rectangle for the run
255- draw .Draw (img ,
256- image .Rect (colors .x , colors .y , colors .x + colors .textWidth , colors .y + r .config .RowHeight ),
257- & image.Uniform {colors .bg },
258- image.Point {},
259- draw .Src )
257+ // Draw background rectangle only if it's not the default color
258+ if ! catalog .IsDefault (run .Attrs .BG ) {
259+ draw .Draw (img ,
260+ image .Rect (colors .x , colors .y , colors .x + colors .textWidth , colors .y + r .config .RowHeight ),
261+ & image.Uniform {colors .bg },
262+ image.Point {},
263+ draw .Src )
264+ }
260265
261266 // Draw text directly to paletted image
262267 drawer := & font.Drawer {
0 commit comments