Strengthen top bar scrim gradient on macOS player controls

This commit is contained in:
Arkadiusz Fal
2026-07-08 23:43:02 +02:00
parent 9918a68d73
commit ffcb73fe33

View File

@@ -155,11 +155,11 @@ struct MacOSPlayerControlsView: View {
.padding(.bottom, 24) .padding(.bottom, 24)
.frame(maxWidth: .infinity, alignment: .leading) .frame(maxWidth: .infinity, alignment: .leading)
.background( .background(
LinearGradient( topBarScrim
colors: [.black.opacity(0.55), .clear], // Extend the scrim past the bar's bottom edge so the fade has
startPoint: .top, endPoint: .bottom // more room and doesn't end right under the title text.
) .padding(.bottom, -24)
.allowsHitTesting(false) .allowsHitTesting(false)
) )
.background( .background(
TrafficLightInsetReader(inset: $trafficLightInset) TrafficLightInsetReader(inset: $trafficLightInset)
@@ -167,6 +167,29 @@ struct MacOSPlayerControlsView: View {
) )
} }
/// Alpha ramp shared by both scrim variants: multi-stop eased fade so the
/// scrim has no visible hard edge where it ends.
private func scrimGradient(maxOpacity: Double) -> LinearGradient {
LinearGradient(
stops: [
.init(color: .black.opacity(maxOpacity), location: 0),
.init(color: .black.opacity(maxOpacity * 0.8), location: 0.35),
.init(color: .black.opacity(maxOpacity * 0.45), location: 0.65),
.init(color: .black.opacity(maxOpacity * 0.15), location: 0.85),
.init(color: .clear, location: 1),
],
startPoint: .top, endPoint: .bottom
)
}
/// Background behind the top bar keeping the title/author legible over the
/// video. A gradient-masked Liquid Glass strip was tried on macOS 26 but
/// rendered poorly over the video layer, so the dimming gradient is used
/// on all versions.
private var topBarScrim: some View {
scrimGradient(maxOpacity: 0.75)
}
// MARK: - Actions // MARK: - Actions
/// Consolidated actions for the section renderers. /// Consolidated actions for the section renderers.