46 lines
1.1 KiB
Swift
46 lines
1.1 KiB
Swift
import SwiftUI
|
|
|
|
// MARK: - Glass Modifier
|
|
//
|
|
// Solid adaptive background — no glass or material effects
|
|
|
|
struct GlassModifier: ViewModifier {
|
|
let cornerRadius: CGFloat
|
|
|
|
private var fillColor: Color {
|
|
RosettaColors.adaptive(
|
|
light: Color(hex: 0xF2F2F7),
|
|
dark: Color(hex: 0x1C1C1E)
|
|
)
|
|
}
|
|
|
|
func body(content: Content) -> some View {
|
|
content
|
|
.background {
|
|
RoundedRectangle(cornerRadius: cornerRadius, style: .continuous)
|
|
.fill(fillColor)
|
|
}
|
|
}
|
|
}
|
|
|
|
// MARK: - View Extension
|
|
|
|
extension View {
|
|
/// Solid background with rounded corners.
|
|
func glass(cornerRadius: CGFloat = 24) -> some View {
|
|
modifier(GlassModifier(cornerRadius: cornerRadius))
|
|
}
|
|
|
|
/// Solid capsule background — convenience for pill-shaped elements.
|
|
func glassCapsule() -> some View {
|
|
background {
|
|
Capsule().fill(
|
|
RosettaColors.adaptive(
|
|
light: Color(hex: 0xF2F2F7),
|
|
dark: Color(hex: 0x1C1C1E)
|
|
)
|
|
)
|
|
}
|
|
}
|
|
}
|