-
Notifications
You must be signed in to change notification settings - Fork 36
Pre-composite backdrop color #85
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 |
|---|---|---|
|
|
@@ -187,7 +187,24 @@ struct TabBarView: View { | |
| .overlay(alignment: .trailing) { | ||
| if showSplitButtons { | ||
| let shouldShow = presentationMode != "minimal" || isHoveringTabBar | ||
| let bg = Color(nsColor: TabBarColors.nsColorPaneBackground(for: appearance).withAlphaComponent(1.0)) | ||
| // Pre-composite: produce the flat opaque color that | ||
| // matches what .background(barFill) looks like over the | ||
| // window background. Avoids double-compositing mismatch. | ||
| let bg: Color = { | ||
| let chrome = TabBarColors.nsColorPaneBackground(for: appearance) | ||
| let winBg = NSColor.windowBackgroundColor | ||
|
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.
A more accurate approach would be to read the window's |
||
| guard let fg = chrome.usingColorSpace(.sRGB), | ||
| let bk = winBg.usingColorSpace(.sRGB) else { | ||
| return Color(nsColor: chrome.withAlphaComponent(1.0)) | ||
| } | ||
| let a = isFocused ? fg.alphaComponent : fg.alphaComponent * 0.95 | ||
|
Comment on lines
+194
to
+200
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.
The comment states this should "match what
When no custom chrome color is configured (the default theme), these diverge:
With The fix is to use the same let chrome = TabBarColors.nsColorPaneBackground(for: appearance)
// Use the same fallback as barBackground(for:) so fg matches barFill
let effectiveFg = chrome.alphaComponent > 0
? chrome
: NSColor.windowBackgroundColorOr, preferably, add a |
||
| return Color(nsColor: NSColor( | ||
| sRGBRed: fg.redComponent * a + bk.redComponent * (1 - a), | ||
| green: fg.greenComponent * a + bk.greenComponent * (1 - a), | ||
| blue: fg.blueComponent * a + bk.blueComponent * (1 - a), | ||
| alpha: 1.0 | ||
| )) | ||
| }() | ||
| ZStack(alignment: .trailing) { | ||
| // Backdrop: fade gradient then solid | ||
| HStack(spacing: 0) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
P2: The pre-composite backdrop uses
nsColorPaneBackground, but the tab bar itself usesbarBackground. Their fallback colors differ, so the new blended backdrop can still mismatch the actual bar color in default appearance.Prompt for AI agents