mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-06-06 15:38:39 +03:00
Fix barely visible new tab button on macOS (#5897)
Resolve #5894 and #4288
This commit is contained in:
@ -212,6 +212,9 @@ class TerminalController: BaseTerminalController {
|
|||||||
// Set our explicit appearance if we need to based on the configuration.
|
// Set our explicit appearance if we need to based on the configuration.
|
||||||
window.appearance = surfaceConfig.windowAppearance
|
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
|
// 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
|
// have no effect if the window is not visible. Ultimately, we'll have this called
|
||||||
// at some point when a surface becomes focused.
|
// at some point when a surface becomes focused.
|
||||||
|
@ -3,6 +3,10 @@ import Cocoa
|
|||||||
class TerminalWindow: NSWindow {
|
class TerminalWindow: NSWindow {
|
||||||
@objc dynamic var keyEquivalent: String = ""
|
@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 {
|
lazy var titlebarColor: NSColor = backgroundColor {
|
||||||
didSet {
|
didSet {
|
||||||
guard let titlebarContainer else { return }
|
guard let titlebarContainer else { return }
|
||||||
@ -295,7 +299,6 @@ class TerminalWindow: NSWindow {
|
|||||||
|
|
||||||
|
|
||||||
if newTabButtonImageLayer == nil {
|
if newTabButtonImageLayer == nil {
|
||||||
let isLightTheme = backgroundColor.isLightColor
|
|
||||||
let fillColor: NSColor = isLightTheme ? .black.withAlphaComponent(0.85) : .white.withAlphaComponent(0.85)
|
let fillColor: NSColor = isLightTheme ? .black.withAlphaComponent(0.85) : .white.withAlphaComponent(0.85)
|
||||||
let newImage = NSImage(size: newTabButtonImage.size, flipped: false) { rect in
|
let newImage = NSImage(size: newTabButtonImage.size, flipped: false) { rect in
|
||||||
newTabButtonImage.draw(in: rect)
|
newTabButtonImage.draw(in: rect)
|
||||||
@ -714,7 +717,7 @@ fileprivate class WindowButtonsBackdropView: NSView {
|
|||||||
|
|
||||||
init(window: TerminalWindow) {
|
init(window: TerminalWindow) {
|
||||||
self.terminalWindow = window
|
self.terminalWindow = window
|
||||||
self.isLightTheme = window.backgroundColor.isLightColor
|
self.isLightTheme = window.isLightTheme
|
||||||
|
|
||||||
super.init(frame: .zero)
|
super.init(frame: .zero)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user