Skip to content

Commit 1b8a0eb

Browse files
committed
Fix: macOS background color rendering using incorrect color
On macOS, NSRect.fill(using:) uses NSColor (set via NSColor.set() or setFill()), not the CGContext's fill color that was set via context.setFillColor(). This caused background colors to be rendered incorrectly - for example, when running `ls --color` in a terminal, files that should have colored foreground text would instead appear with that color as background. The fix adds backgroundColor.setFill() before calling rect.fill() to ensure the correct NSColor is used for background rendering.
1 parent 7f7541a commit 1b8a0eb

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

Sources/SwiftTerm/Apple/AppleTerminalView.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,9 @@ extension TerminalView {
766766
}
767767

768768
#if os(macOS)
769+
// NSRect.fill() uses NSColor (set via NSColor.set()/setFill()),
770+
// not CGContext's fill color. Must call setFill() before fill().
771+
backgroundColor.setFill()
769772
rect.fill(using: .destinationOver)
770773
#else
771774
context.fill(rect)

0 commit comments

Comments
 (0)