import AppKit import SwiftUI /// Gestaltung: ein normales Mac-Fenster in Systemfarben. Gold ist der einzige /// Akzent (README, "Gestaltung") und markiert nur zwei Dinge: die Hauptaktion /// und den Ausschnitt. extension Color { /// #C8A96A im Dunkeln; im Hellen dunkler, damit Text darauf lesbar bleibt. static let gold = Color(nsColor: NSColor(name: nil) { appearance in appearance.bestMatch(from: [.darkAqua, .aqua]) == .darkAqua ? NSColor(srgbRed: 0.784, green: 0.663, blue: 0.416, alpha: 1) : NSColor(srgbRed: 0.604, green: 0.482, blue: 0.235, alpha: 1) }) /// Schrift auf Gold: dunkel auf hellem Gold, weiß auf dunklem Gold. static let onGold = Color(nsColor: NSColor(name: nil) { appearance in appearance.bestMatch(from: [.darkAqua, .aqua]) == .darkAqua ? NSColor(srgbRed: 0.043, green: 0.043, blue: 0.047, alpha: 1) : .white }) static let attention = Color(nsColor: .systemOrange) } /// Die eine Hauptaktion eines Fensters (Start, Übernehmen). struct ProminentButtonStyle: ButtonStyle { @Environment(\.isEnabled) private var isEnabled func makeBody(configuration: Configuration) -> some View { configuration.label .font(.system(size: 12, weight: .semibold)) .foregroundStyle(isEnabled ? Color.onGold : Color.secondary) .padding(.horizontal, 14) .padding(.vertical, 4) .background( RoundedRectangle(cornerRadius: 6, style: .continuous) .fill(isEnabled ? Color.gold.opacity(configuration.isPressed ? 0.8 : 1) : Color.secondary.opacity(0.15)) ) .contentShape(Rectangle()) } }