diff --git a/macos/Sources/Features/Command Palette/CommandPalette.swift b/macos/Sources/Features/Command Palette/CommandPalette.swift index 9a3ed3965..53070c5db 100644 --- a/macos/Sources/Features/Command Palette/CommandPalette.swift +++ b/macos/Sources/Features/Command Palette/CommandPalette.swift @@ -18,6 +18,7 @@ struct CommandOption: Identifiable, Hashable { struct CommandPaletteView: View { @Binding var isPresented: Bool + var backgroundColor: Color = Color(nsColor: .windowBackgroundColor) var options: [CommandOption] @State private var query = "" @State private var selectedIndex: UInt? @@ -43,6 +44,12 @@ struct CommandPaletteView: View { } var body: some View { + @State var scheme: ColorScheme = if OSColor(backgroundColor).isLightColor { + .light + } else { + .dark + } + VStack(alignment: .leading, spacing: 0) { CommandPaletteQuery(query: $query) { event in switch (event) { @@ -98,7 +105,16 @@ struct CommandPaletteView: View { } } .frame(maxWidth: 500) - .background(BackgroundVisualEffectView()) + .background( + ZStack { + Rectangle() + .fill(.ultraThinMaterial) + Rectangle() + .fill(backgroundColor) + .blendMode(.color) + } + .compositingGroup() + ) .clipShape(RoundedRectangle(cornerRadius: 10)) .overlay( RoundedRectangle(cornerRadius: 10) @@ -106,6 +122,7 @@ struct CommandPaletteView: View { ) .shadow(radius: 32, x: 0, y: 12) .padding() + .environment(\.colorScheme, scheme) } } @@ -244,23 +261,6 @@ fileprivate struct CommandRow: View { } } -/// A view that creates a semi-transparent blurry background. -fileprivate struct BackgroundVisualEffectView: NSViewRepresentable { - func makeNSView(context: Context) -> NSVisualEffectView { - let view = NSVisualEffectView() - - view.blendingMode = .withinWindow - view.state = .active - view.material = .sidebar - - return view - } - - func updateNSView(_ nsView: NSVisualEffectView, context: Context) { - // - } -} - /// A row of Text representing a shortcut. fileprivate struct ShortcutSymbolsView: View { let symbols: [String] diff --git a/macos/Sources/Features/Command Palette/TerminalCommandPalette.swift b/macos/Sources/Features/Command Palette/TerminalCommandPalette.swift index f2c0f1989..affbc4ddc 100644 --- a/macos/Sources/Features/Command Palette/TerminalCommandPalette.swift +++ b/macos/Sources/Features/Command Palette/TerminalCommandPalette.swift @@ -59,6 +59,7 @@ struct TerminalCommandPaletteView: View { CommandPaletteView( isPresented: $isPresented, + backgroundColor: ghosttyConfig.backgroundColor, options: commandOptions ) .transition(