From 17302ee8116fb00553e3b0c86e54ab75ccfd58f9 Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Sun, 19 Jul 2026 16:34:33 +0200 Subject: [PATCH] feat(apple/widgets): Dynamic Island rebuild + brand purple everywhere MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The widgets rendered system BLUE because Color.brand lived in PunktfunkKit, which the extension deliberately never links (Rust staticlib) — .tint had nothing to resolve against. Color.brand moved to PunktfunkShared (Kit re-exports Shared, every existing use unaffected); the Live Activity and the Hosts widget now carry the actual brand purple, plus .keylineTint on the island. Island layout rebuilt around purpose per surface: - Expanded: identity leading (brand glyph + host, semibold), elapsed clock trailing, game title center; the bottom is ONE row — status dot + stage (backgrounded shows the disconnect countdown inline) over a quiet stats line (live latency + bitrate, previously collected but never rendered, ahead of the mode) with the End button at the trailing edge. - Compact trailing is the one glanceable number: live latency (green) while streaming, the disconnect countdown (orange) while backgrounded, a state glyph when reconnecting/ended. Leading/minimal: brand glyph. - Lock Screen banner adopts the same shared StatusLine/StatsLine pieces so both surfaces agree. PunktfunkWidgetsExtension + iOS + tvOS device builds, swift build/test (20/20) all green; canvas previews cover every state. Co-Authored-By: Claude Fable 5 --- .../Sources/PunktfunkShared/BrandColor.swift | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 clients/apple/Sources/PunktfunkShared/BrandColor.swift diff --git a/clients/apple/Sources/PunktfunkShared/BrandColor.swift b/clients/apple/Sources/PunktfunkShared/BrandColor.swift new file mode 100644 index 00000000..284c6d88 --- /dev/null +++ b/clients/apple/Sources/PunktfunkShared/BrandColor.swift @@ -0,0 +1,30 @@ +// The brand color, in the dependency-free foundation so EVERY process can use it — the widget +// extension links PunktfunkShared alone (never PunktfunkKit's Rust staticlib), and before this +// moved here the Live Activity / widgets fell back to `.tint` = system blue. + +import SwiftUI + +public extension Color { + /// The punktfunk brand purple (the app-icon lens / website `--brand`). Defined explicitly, + /// independent of the asset-catalog accent — `Color.accentColor` resolution is environment- and + /// timing-sensitive (it can fall back to system blue), and the brand mark must never drift. + /// Light: #6656F2, Dark: #8678F5 (the lighter violet reads better on dark surfaces). + static let brand: Color = { + #if canImport(UIKit) + return Color(UIColor { traits in + traits.userInterfaceStyle == .dark + ? UIColor(red: 0x86 / 255, green: 0x78 / 255, blue: 0xF5 / 255, alpha: 1) + : UIColor(red: 0x66 / 255, green: 0x56 / 255, blue: 0xF2 / 255, alpha: 1) + }) + #elseif canImport(AppKit) + return Color(NSColor(name: nil) { appearance in + appearance.bestMatch(from: [.aqua, .darkAqua]) == .darkAqua + ? NSColor(red: 0x86 / 255, green: 0x78 / 255, blue: 0xF5 / 255, alpha: 1) + : NSColor(red: 0x66 / 255, green: 0x56 / 255, blue: 0xF2 / 255, alpha: 1) + }) + #else + // Non-Apple fallback: the light brand value, so all branches agree on a canonical color. + return Color(red: 0x66 / 255, green: 0x56 / 255, blue: 0xF2 / 255) + #endif + }() +}