Fix barely visible new tab button on macOS (#5897)

Resolve #5894 and #4288
This commit is contained in:
Mitchell Hashimoto
2025-02-21 15:47:33 -08:00
committed by GitHub
2 changed files with 8 additions and 2 deletions

View File

@ -212,6 +212,9 @@ class TerminalController: BaseTerminalController {
// Set our explicit appearance if we need to based on the configuration.
window.appearance = surfaceConfig.windowAppearance
// Update our window light/darkness based on our updated background color
window.isLightTheme = OSColor(surfaceConfig.backgroundColor).isLightColor
// If our window is not visible, then we do nothing. Some things such as blurring
// have no effect if the window is not visible. Ultimately, we'll have this called
// at some point when a surface becomes focused.

View File

@ -3,6 +3,10 @@ import Cocoa
class TerminalWindow: NSWindow {
@objc dynamic var keyEquivalent: String = ""
/// This is used to determine if certain elements should be drawn light or dark and should
/// be updated whenever the window background color or surrounding elements changes.
var isLightTheme: Bool = false
lazy var titlebarColor: NSColor = backgroundColor {
didSet {
guard let titlebarContainer else { return }
@ -295,7 +299,6 @@ class TerminalWindow: NSWindow {
if newTabButtonImageLayer == nil {
let isLightTheme = backgroundColor.isLightColor
let fillColor: NSColor = isLightTheme ? .black.withAlphaComponent(0.85) : .white.withAlphaComponent(0.85)
let newImage = NSImage(size: newTabButtonImage.size, flipped: false) { rect in
newTabButtonImage.draw(in: rect)
@ -714,7 +717,7 @@ fileprivate class WindowButtonsBackdropView: NSView {
init(window: TerminalWindow) {
self.terminalWindow = window
self.isLightTheme = window.backgroundColor.isLightColor
self.isLightTheme = window.isLightTheme
super.init(frame: .zero)