Merge pull request #398 from manaflow-ai/task-light-mode-browser-omnibar-theme-bg

Fix light-mode browser omnibar chrome background
This commit is contained in:
Lawrence Chen 2026-02-23 18:25:55 -08:00 committed by GitHub
commit 4e455a185c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 113 additions and 9 deletions

View file

@ -166,6 +166,35 @@ private extension View {
}
}
func resolvedBrowserChromeBackgroundColor(
for colorScheme: ColorScheme,
themeBackgroundColor: NSColor
) -> NSColor {
switch colorScheme {
case .dark, .light:
return themeBackgroundColor
@unknown default:
return themeBackgroundColor
}
}
func resolvedBrowserOmnibarPillBackgroundColor(
for colorScheme: ColorScheme,
themeBackgroundColor: NSColor
) -> NSColor {
let darkenMix: CGFloat
switch colorScheme {
case .light:
darkenMix = 0.04
case .dark:
darkenMix = 0.05
@unknown default:
darkenMix = 0.04
}
return themeBackgroundColor.blended(withFraction: darkenMix, of: .black) ?? themeBackgroundColor
}
/// View for rendering a browser panel with address bar
struct BrowserPanelView: View {
@ObservedObject var panel: BrowserPanel
@ -239,14 +268,17 @@ struct BrowserPanelView: View {
}
private var browserChromeBackgroundColor: NSColor {
switch colorScheme {
case .dark:
return GhosttyApp.shared.defaultBackgroundColor
case .light:
return .windowBackgroundColor
@unknown default:
return .windowBackgroundColor
}
resolvedBrowserChromeBackgroundColor(
for: colorScheme,
themeBackgroundColor: GhosttyApp.shared.defaultBackgroundColor
)
}
private var omnibarPillBackgroundColor: NSColor {
resolvedBrowserOmnibarPillBackgroundColor(
for: colorScheme,
themeBackgroundColor: browserChromeBackgroundColor
)
}
var body: some View {
@ -648,7 +680,7 @@ struct BrowserPanelView: View {
.padding(.vertical, 4)
.background(
RoundedRectangle(cornerRadius: omnibarPillCornerRadius, style: .continuous)
.fill(Color(nsColor: .textBackgroundColor))
.fill(Color(nsColor: omnibarPillBackgroundColor))
)
.overlay(
RoundedRectangle(cornerRadius: omnibarPillCornerRadius, style: .continuous)