macOS: update window appearance based on preferredBackgroundColor

This commit is contained in:
Lars
2025-10-25 18:08:53 +02:00
parent 3f75c66e83
commit d39cc6d478
3 changed files with 9 additions and 1 deletions

View File

@@ -143,6 +143,10 @@ class TitlebarTabsVenturaTerminalWindow: TerminalWindow {
override func syncAppearance(_ surfaceConfig: Ghostty.SurfaceView.DerivedConfig) {
super.syncAppearance(surfaceConfig)
// override appearance based on the terminal's background color
if let preferredBackgroundColor {
appearance = (preferredBackgroundColor.isLightColor ? NSAppearance(named: .aqua) : NSAppearance(named: .darkAqua))
}
// Update our window light/darkness based on our updated background color
let themeChanged = isLightTheme != OSColor(surfaceConfig.backgroundColor).isLightColor

View File

@@ -59,6 +59,10 @@ class TransparentTitlebarTerminalWindow: TerminalWindow {
override func syncAppearance(_ surfaceConfig: Ghostty.SurfaceView.DerivedConfig) {
super.syncAppearance(surfaceConfig)
// override appearance based on the terminal's background color
if let preferredBackgroundColor {
appearance = (preferredBackgroundColor.isLightColor ? NSAppearance(named: .aqua) : NSAppearance(named: .darkAqua))
}
// Save our config in case we need to reapply
lastSurfaceConfig = surfaceConfig