macOS: update window appearance based on `preferredBackgroundColor`
parent
3f75c66e83
commit
d39cc6d478
|
|
@ -143,6 +143,10 @@ class TitlebarTabsVenturaTerminalWindow: TerminalWindow {
|
||||||
|
|
||||||
override func syncAppearance(_ surfaceConfig: Ghostty.SurfaceView.DerivedConfig) {
|
override func syncAppearance(_ surfaceConfig: Ghostty.SurfaceView.DerivedConfig) {
|
||||||
super.syncAppearance(surfaceConfig)
|
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
|
// Update our window light/darkness based on our updated background color
|
||||||
let themeChanged = isLightTheme != OSColor(surfaceConfig.backgroundColor).isLightColor
|
let themeChanged = isLightTheme != OSColor(surfaceConfig.backgroundColor).isLightColor
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,10 @@ class TransparentTitlebarTerminalWindow: TerminalWindow {
|
||||||
|
|
||||||
override func syncAppearance(_ surfaceConfig: Ghostty.SurfaceView.DerivedConfig) {
|
override func syncAppearance(_ surfaceConfig: Ghostty.SurfaceView.DerivedConfig) {
|
||||||
super.syncAppearance(surfaceConfig)
|
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
|
// Save our config in case we need to reapply
|
||||||
lastSurfaceConfig = surfaceConfig
|
lastSurfaceConfig = surfaceConfig
|
||||||
|
|
|
||||||
|
|
@ -1765,7 +1765,7 @@ keybind: Keybinds = .{},
|
||||||
/// * `ghostty` - Use the background and foreground colors specified in the
|
/// * `ghostty` - Use the background and foreground colors specified in the
|
||||||
/// Ghostty configuration. This is only supported on Linux builds.
|
/// Ghostty configuration. This is only supported on Linux builds.
|
||||||
///
|
///
|
||||||
/// On macOS, if `macos-titlebar-style` is "tabs", the window theme will be
|
/// On macOS, if `macos-titlebar-style` is `tabs` or `transparent`, the window theme will be
|
||||||
/// automatically set based on the luminosity of the terminal background color.
|
/// automatically set based on the luminosity of the terminal background color.
|
||||||
/// This only applies to terminal windows. This setting will still apply to
|
/// This only applies to terminal windows. This setting will still apply to
|
||||||
/// non-terminal windows within Ghostty.
|
/// non-terminal windows within Ghostty.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue