Repository navigation
Fix titlebar icons invisible when sidebar closed with dark Ghostty theme in light macOS #482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -479,11 +479,27 @@ struct TitlebarControlsView: View { | |
| .background(ShortcutHintPillBackground()) | ||
| } | ||
|
|
||
| private var iconForegroundColor: Color? { | ||
| let sidebarVisible = AppDelegate.shared?.sidebarState?.isVisible ?? false | ||
| guard !sidebarVisible else { return nil } | ||
| let bg = GhosttyApp.shared.defaultBackgroundColor | ||
| return bg.isLightColor | ||
|
Comment on lines
+483
to
+486
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||
| ? Color.black.opacity(0.55) | ||
| : Color.white.opacity(0.65) | ||
| } | ||
|
|
||
| @ViewBuilder | ||
| private func iconLabel(systemName: String, config: TitlebarControlsStyleConfig) -> some View { | ||
| let icon = Image(systemName: systemName) | ||
| let baseIcon = Image(systemName: systemName) | ||
| .font(.system(size: config.iconSize, weight: .semibold)) | ||
| .frame(width: config.buttonSize, height: config.buttonSize) | ||
| let icon = Group { | ||
| if let color = iconForegroundColor { | ||
| baseIcon.foregroundColor(color) | ||
| } else { | ||
| baseIcon | ||
| } | ||
| } | ||
|
|
||
| if config.buttonBackground { | ||
| icon | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iconForegroundColorreadsAppDelegate.shared?.sidebarState?.isVisible, butAppDelegate.sidebarStateis a single active-window pointer that gets reassigned insetActiveMainWindow(Sources/AppDelegate.swift).TitlebarControlsViewis instantiated per window, so in multi-window sessions this can tint icons using another window’s sidebar state (for example, a window with an open sidebar can still get the “sidebar closed” tint when a different window is active), which reintroduces low-contrast icons in the wrong window.Useful? React with 👍 / 👎.