Commit 42a3851969

42a385196913dc8d1d9ee9a6ea134db4fa4cd546

parent: ea21f9ec4d

Verified · cmc

cmc <hello@cleberg.net> · 2026-10-14 13:59 UTC

Theme accent tints controls

Layout: unified · split

Sources/Orgstar/OrgstarApp.swift +4
@@ -337,6 +337,7 @@ struct OrgstarApp: App {
337 case .success(let model): 337 case .success(let model):
338 ContentView(workspace: model, session: session, commands: commands, scheduler: scheduler, clock: clock) 338 ContentView(workspace: model, session: session, commands: commands, scheduler: scheduler, clock: clock)
339 .environment(\.orgTheme, ConfigSync.shared.theme) 339 .environment(\.orgTheme, ConfigSync.shared.theme)
340 .tint(ConfigSync.shared.theme.color("accent"))
340 .onAppear { 341 .onAppear {
341 delegate.session = session 342 delegate.session = session
342 delegate.commands = commands 343 delegate.commands = commands
@@ -351,6 +352,7 @@ struct OrgstarApp: App {
351 if case .success = workspace { 352 if case .success = workspace {
352 EditorWindowView(session: session, commands: commands, clock: clock) 353 EditorWindowView(session: session, commands: commands, clock: clock)
353 .environment(\.orgTheme, ConfigSync.shared.theme) 354 .environment(\.orgTheme, ConfigSync.shared.theme)
355 .tint(ConfigSync.shared.theme.color("accent"))
354 } 356 }
355 } 357 }
356 .defaultSize(width: 900, height: 700) 358 .defaultSize(width: 900, height: 700)
@@ -359,6 +361,7 @@ struct OrgstarApp: App {
359 if case .success(let model) = workspace { 361 if case .success(let model) = workspace {
360 AgendaView(workspace: model, session: session, commands: commands, scheduler: scheduler, clock: clock) 362 AgendaView(workspace: model, session: session, commands: commands, scheduler: scheduler, clock: clock)
361 .environment(\.orgTheme, ConfigSync.shared.theme) 363 .environment(\.orgTheme, ConfigSync.shared.theme)
364 .tint(ConfigSync.shared.theme.color("accent"))
362 } 365 }
363 } 366 }
364 .defaultSize(width: 760, height: 720) 367 .defaultSize(width: 760, height: 720)
@@ -366,6 +369,7 @@ struct OrgstarApp: App {
366 if case .success(let model) = workspace { 369 if case .success(let model) = workspace {
367 BoardView(workspace: model, session: session, commands: commands) 370 BoardView(workspace: model, session: session, commands: commands)
368 .environment(\.orgTheme, ConfigSync.shared.theme) 371 .environment(\.orgTheme, ConfigSync.shared.theme)
372 .tint(ConfigSync.shared.theme.color("accent"))
369 } 373 }
370 } 374 }
371 .defaultSize(width: 1100, height: 700) 375 .defaultSize(width: 1100, height: 700)
Sources/OrgstarMobile/MobileTheme.swift +12
@@ -153,4 +153,16 @@ struct MobileTheme {
153 /// A theme color for SwiftUI views. 153 /// A theme color for SwiftUI views.
154 func swiftColor(_ key: String) -> Color? { color(key).map { Color(uiColor: $0) } } 154 func swiftColor(_ key: String) -> Color? { color(key).map { Color(uiColor: $0) } }
155} 155}
156extension ThemeSpec {
157 /// `accent` for `.tint`, the system's blue in an appearance the theme leaves it unset; nil
158 /// when neither appearance sets it.
159 var accentColor: Color? {
160 let (light, dark) = (light["accent"], dark["accent"])
161 guard light != nil || dark != nil else { return nil }
162 return Color(uiColor: UIColor { traits in
163 guard let c = traits.userInterfaceStyle == .dark ? dark : light else { return .systemBlue }
164 return UIColor(red: c.red, green: c.green, blue: c.blue, alpha: c.alpha)
165 })
166 }
167}
156#endif 168#endif
Sources/OrgstarMobile/OrgstarMobileApp.swift +1
@@ -190,6 +190,7 @@ struct RootView: View {
190 } 190 }
191 } 191 }
192 .clockAccessory(model.clock, perform: clock) 192 .clockAccessory(model.clock, perform: clock)
193 .tint(model.theme.accentColor)
193 // Until a folder is added there is nothing for the agenda to show. 194 // Until a folder is added there is nothing for the agenda to show.
194 .onAppear { if workspace.rootPaths.isEmpty { tab = .folders } } 195 .onAppear { if workspace.rootPaths.isEmpty { tab = .folders } }
195 .sheet(item: Binding(get: { model.clockPrompts.pending }, set: { if $0 == nil { model.clockPrompts.answer(nil) } })) { pending in 196 .sheet(item: Binding(get: { model.clockPrompts.pending }, set: { if $0 == nil { model.clockPrompts.answer(nil) } })) { pending in