Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Demo/Demo/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ struct ContentView: View {
}
.padding()
.frame(minWidth: 500, minHeight: 350)
.background(VisualEffect.nonVibrant())
}
}
16 changes: 14 additions & 2 deletions Sources/MacControlCenterUI/Utilities/VisualEffect.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,24 @@ extension VisualEffect {

extension View {
/// Applies the appropriate window background effect for the menu based on the current platform.
@ViewBuilder
func menuBackgroundEffectForCurrentPlatform() -> some View {
if #available(macOS 26.0, *) {
return backgroundStyle(.ultraThinMaterial /* .thinMaterial */ )
menuBackgroundEffectForCurrentPlatformBase()
.windowResizeAnchor(.topLeading) // helps with smooth menu window resize animations
} else {
return background(VisualEffect.popoverWindow())
menuBackgroundEffectForCurrentPlatformBase()
}
}

@ViewBuilder
private func menuBackgroundEffectForCurrentPlatformBase() -> some View {
if #available(macOS 27.0, *) {
backgroundStyle(.regularMaterial)
} else if #available(macOS 26.0, *) {
backgroundStyle(.ultraThinMaterial)
} else {
background(VisualEffect.popoverWindow())
}
}

Expand Down