forked from tddworks/ClaudeBar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProviderVisualIdentity.swift
More file actions
538 lines (463 loc) · 18.2 KB
/
Copy pathProviderVisualIdentity.swift
File metadata and controls
538 lines (463 loc) · 18.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
import SwiftUI
import Domain
// MARK: - Provider Visual Identity Protocol
/// Defines visual identity for AI providers.
/// Each concrete provider implements this to own its visual representation.
/// This keeps visual properties with the provider (rich domain) while
/// separating SwiftUI dependencies from the Domain layer.
public protocol ProviderVisualIdentity {
/// SF Symbol icon name for this provider
var symbolIcon: String { get }
/// Icon asset name in the asset catalog
var iconAssetName: String { get }
/// Theme color for this provider
func themeColor(for scheme: ColorScheme) -> Color
/// Theme gradient for this provider
func themeGradient(for scheme: ColorScheme) -> LinearGradient
}
// MARK: - ClaudeProvider Visual Identity
extension ClaudeProvider: ProviderVisualIdentity {
public var symbolIcon: String { "brain.fill" }
public var iconAssetName: String { "ClaudeIcon" }
public func themeColor(for scheme: ColorScheme) -> Color {
scheme == .dark
? BaseTheme.coralAccent
: Color(red: 0.95, green: 0.48, blue: 0.38)
}
public func themeGradient(for scheme: ColorScheme) -> LinearGradient {
LinearGradient(
colors: [
themeColor(for: scheme),
scheme == .dark ? BaseTheme.pinkHot : Color(red: 0.92, green: 0.45, blue: 0.72)
],
startPoint: .topLeading,
endPoint: .bottomTrailing
)
}
}
// MARK: - CodexProvider Visual Identity
extension CodexProvider: ProviderVisualIdentity {
public var symbolIcon: String { "chevron.left.forwardslash.chevron.right" }
public var iconAssetName: String { "CodexIcon" }
public func themeColor(for scheme: ColorScheme) -> Color {
scheme == .dark
? BaseTheme.tealBright
: Color(red: 0.18, green: 0.72, blue: 0.68)
}
public func themeGradient(for scheme: ColorScheme) -> LinearGradient {
LinearGradient(
colors: [
themeColor(for: scheme),
scheme == .dark
? Color(red: 0.25, green: 0.65, blue: 0.85)
: Color(red: 0.12, green: 0.52, blue: 0.72)
],
startPoint: .topLeading,
endPoint: .bottomTrailing
)
}
}
// MARK: - GeminiProvider Visual Identity
extension GeminiProvider: ProviderVisualIdentity {
public var symbolIcon: String { "sparkles" }
public var iconAssetName: String { "GeminiIcon" }
public func themeColor(for scheme: ColorScheme) -> Color {
scheme == .dark
? BaseTheme.goldenGlow
: Color(red: 0.92, green: 0.72, blue: 0.28)
}
public func themeGradient(for scheme: ColorScheme) -> LinearGradient {
LinearGradient(
colors: [
themeColor(for: scheme),
scheme == .dark
? Color(red: 0.95, green: 0.55, blue: 0.35)
: Color(red: 0.85, green: 0.45, blue: 0.25)
],
startPoint: .topLeading,
endPoint: .bottomTrailing
)
}
}
// MARK: - CopilotProvider Visual Identity
extension CopilotProvider: ProviderVisualIdentity {
public var symbolIcon: String { "chevron.left.forwardslash.chevron.right" }
public var iconAssetName: String { "CopilotIcon" }
public func themeColor(for scheme: ColorScheme) -> Color {
// GitHub's blue color
scheme == .dark
? Color(red: 0.38, green: 0.55, blue: 0.93)
: Color(red: 0.26, green: 0.43, blue: 0.82)
}
public func themeGradient(for scheme: ColorScheme) -> LinearGradient {
LinearGradient(
colors: [
themeColor(for: scheme),
scheme == .dark
? Color(red: 0.55, green: 0.40, blue: 0.90)
: Color(red: 0.45, green: 0.30, blue: 0.80)
],
startPoint: .topLeading,
endPoint: .bottomTrailing
)
}
}
// MARK: - AntigravityProvider Visual Identity
extension AntigravityProvider: ProviderVisualIdentity {
public var symbolIcon: String { "wand.and.stars" }
public var iconAssetName: String { "AntigravityIcon" }
public func themeColor(for scheme: ColorScheme) -> Color {
// Purple/magenta color matching Antigravity branding
scheme == .dark
? Color(red: 0.72, green: 0.35, blue: 0.85)
: Color(red: 0.58, green: 0.22, blue: 0.72)
}
public func themeGradient(for scheme: ColorScheme) -> LinearGradient {
LinearGradient(
colors: [
themeColor(for: scheme),
scheme == .dark
? Color(red: 0.45, green: 0.25, blue: 0.75)
: Color(red: 0.35, green: 0.15, blue: 0.65)
],
startPoint: .topLeading,
endPoint: .bottomTrailing
)
}
}
// MARK: - ZaiProvider Visual Identity
extension ZaiProvider: ProviderVisualIdentity {
public var symbolIcon: String { "z.square.fill" }
public var iconAssetName: String { "ZaiIcon" }
public func themeColor(for scheme: ColorScheme) -> Color {
// Blue color matching Z.ai branding
scheme == .dark
? Color(red: 0.35, green: 0.60, blue: 1.0)
: Color(red: 0.23, green: 0.51, blue: 0.96)
}
public func themeGradient(for scheme: ColorScheme) -> LinearGradient {
LinearGradient(
colors: [
themeColor(for: scheme),
scheme == .dark
? Color(red: 0.30, green: 0.45, blue: 0.85)
: Color(red: 0.20, green: 0.35, blue: 0.75)
],
startPoint: .topLeading,
endPoint: .bottomTrailing
)
}
}
// MARK: - BedrockProvider Visual Identity
extension BedrockProvider: ProviderVisualIdentity {
public var symbolIcon: String { "cloud.fill" }
public var iconAssetName: String { "BedrockIcon" }
public func themeColor(for scheme: ColorScheme) -> Color {
// AWS orange color
scheme == .dark
? Color(red: 1.0, green: 0.6, blue: 0.2)
: Color(red: 0.92, green: 0.5, blue: 0.15)
}
public func themeGradient(for scheme: ColorScheme) -> LinearGradient {
LinearGradient(
colors: [
themeColor(for: scheme),
scheme == .dark
? Color(red: 0.85, green: 0.45, blue: 0.15)
: Color(red: 0.75, green: 0.35, blue: 0.1)
],
startPoint: .topLeading,
endPoint: .bottomTrailing
)
}
}
// MARK: - AmpCodeProvider Visual Identity
extension AmpCodeProvider: ProviderVisualIdentity {
public var symbolIcon: String { "bolt.fill" }
public var iconAssetName: String { "AmpCodeIcon" }
public func themeColor(for scheme: ColorScheme) -> Color {
// AmpCode orange color #F34E3F
scheme == .dark
? Color(red: 0.95, green: 0.30, blue: 0.25)
: Color(red: 0.90, green: 0.25, blue: 0.20)
}
public func themeGradient(for scheme: ColorScheme) -> LinearGradient {
let primaryColor = themeColor(for: scheme)
let secondaryColor = scheme == .dark
? Color(red: 0.85, green: 0.20, blue: 0.15)
: Color(red: 0.80, green: 0.15, blue: 0.10)
return LinearGradient(
colors: [primaryColor, secondaryColor],
startPoint: .topLeading,
endPoint: .bottomTrailing
)
}
}
// MARK: - KimiProvider Visual Identity
extension KimiProvider: ProviderVisualIdentity {
public var symbolIcon: String { "k.square.fill" }
public var iconAssetName: String { "KimiIcon" }
public func themeColor(for scheme: ColorScheme) -> Color {
// Blue/cyan color matching Kimi branding
scheme == .dark
? Color(red: 0.30, green: 0.65, blue: 0.95)
: Color(red: 0.20, green: 0.55, blue: 0.85)
}
public func themeGradient(for scheme: ColorScheme) -> LinearGradient {
LinearGradient(
colors: [
themeColor(for: scheme),
scheme == .dark
? Color(red: 0.20, green: 0.50, blue: 0.80)
: Color(red: 0.10, green: 0.40, blue: 0.70)
],
startPoint: .topLeading,
endPoint: .bottomTrailing
)
}
}
// MARK: - KiroProvider Visual Identity
extension KiroProvider: ProviderVisualIdentity {
public var symbolIcon: String { "wand.and.stars.inverse" }
public var iconAssetName: String { "KiroIcon" }
public func themeColor(for scheme: ColorScheme) -> Color {
// Purple/magenta color matching Kiro branding
scheme == .dark
? Color(red: 0.55, green: 0.35, blue: 0.85)
: Color(red: 0.45, green: 0.25, blue: 0.75)
}
public func themeGradient(for scheme: ColorScheme) -> LinearGradient {
LinearGradient(
colors: [
themeColor(for: scheme),
scheme == .dark
? Color(red: 0.70, green: 0.45, blue: 0.95)
: Color(red: 0.60, green: 0.35, blue: 0.85)
],
startPoint: .topLeading,
endPoint: .bottomTrailing
)
}
}
// MARK: - MiniMaxProvider Visual Identity
extension MiniMaxProvider: ProviderVisualIdentity {
public var symbolIcon: String { "waveform" }
public var iconAssetName: String { "MiniMaxIcon" }
public func themeColor(for scheme: ColorScheme) -> Color {
// MiniMax brand pink-orange
scheme == .dark
? Color(red: 0.91, green: 0.27, blue: 0.42)
: Color(red: 0.82, green: 0.20, blue: 0.35)
}
public func themeGradient(for scheme: ColorScheme) -> LinearGradient {
LinearGradient(
colors: [
themeColor(for: scheme),
scheme == .dark
? Color(red: 0.96, green: 0.53, blue: 0.24)
: Color(red: 0.86, green: 0.43, blue: 0.14)
],
startPoint: .topLeading,
endPoint: .bottomTrailing
)
}
}
// MARK: - AIProvider Visual Identity Helper
/// Extension to access visual identity from any AIProvider.
/// Uses type casting to dispatch to the correct implementation.
extension AIProvider {
/// Returns the visual identity if this provider conforms to ProviderVisualIdentity
public var visualIdentity: ProviderVisualIdentity? {
self as? ProviderVisualIdentity
}
/// SF Symbol icon, with fallback for unknown providers
public var symbolIconOrDefault: String {
visualIdentity?.symbolIcon ?? "questionmark.circle.fill"
}
/// Icon asset name, with fallback for unknown providers
public var iconAssetNameOrDefault: String {
visualIdentity?.iconAssetName ?? "QuestionIcon"
}
/// Theme color with fallback
public func themeColorOrDefault(for scheme: ColorScheme) -> Color {
visualIdentity?.themeColor(for: scheme) ?? BaseTheme.purpleVibrant
}
/// Theme gradient with fallback
public func themeGradientOrDefault(for scheme: ColorScheme) -> LinearGradient {
visualIdentity?.themeGradient(for: scheme) ?? LinearGradient(
colors: [BaseTheme.coralAccent, BaseTheme.pinkHot],
startPoint: .leading,
endPoint: .trailing
)
}
}
// MARK: - Static Provider Identity Lookup
/// Static helpers to look up provider visual identity by ID string.
/// Used by views that only have a providerId, not the full AIProvider object.
enum ProviderVisualIdentityLookup {
/// Get provider theme color by ID
static func color(for providerId: String, scheme: ColorScheme) -> Color {
switch providerId {
case "claude":
return scheme == .dark
? BaseTheme.coralAccent
: Color(red: 0.95, green: 0.48, blue: 0.38)
case "codex":
return scheme == .dark
? BaseTheme.tealBright
: Color(red: 0.18, green: 0.72, blue: 0.68)
case "gemini":
return scheme == .dark
? BaseTheme.goldenGlow
: Color(red: 0.92, green: 0.72, blue: 0.28)
case "copilot":
return scheme == .dark
? Color(red: 0.38, green: 0.55, blue: 0.93)
: Color(red: 0.26, green: 0.43, blue: 0.82)
case "antigravity":
return scheme == .dark
? Color(red: 0.72, green: 0.35, blue: 0.85)
: Color(red: 0.58, green: 0.22, blue: 0.72)
case "zai":
return scheme == .dark
? Color(red: 0.35, green: 0.60, blue: 1.0)
: Color(red: 0.23, green: 0.51, blue: 0.96)
case "bedrock":
return scheme == .dark
? Color(red: 1.0, green: 0.6, blue: 0.2)
: Color(red: 0.92, green: 0.5, blue: 0.15)
case "ampcode":
// AmpCode orange
return scheme == .dark
? Color(red: 0.95, green: 0.30, blue: 0.25)
: Color(red: 0.90, green: 0.25, blue: 0.20)
case "kimi":
return scheme == .dark
? Color(red: 0.30, green: 0.65, blue: 0.95)
: Color(red: 0.20, green: 0.55, blue: 0.85)
case "kiro":
return scheme == .dark
? Color(red: 0.55, green: 0.35, blue: 0.85)
: Color(red: 0.45, green: 0.25, blue: 0.75)
case "minimax":
return scheme == .dark
? Color(red: 0.91, green: 0.27, blue: 0.42)
: Color(red: 0.82, green: 0.20, blue: 0.35)
default:
return BaseTheme.purpleVibrant
}
}
/// Get provider gradient by ID
static func gradient(for providerId: String, scheme: ColorScheme) -> LinearGradient {
let primaryColor = color(for: providerId, scheme: scheme)
let secondaryColor: Color
switch providerId {
case "claude":
secondaryColor = scheme == .dark
? BaseTheme.pinkHot
: Color(red: 0.92, green: 0.45, blue: 0.72)
case "codex":
secondaryColor = scheme == .dark
? Color(red: 0.25, green: 0.65, blue: 0.85)
: Color(red: 0.12, green: 0.52, blue: 0.72)
case "gemini":
secondaryColor = scheme == .dark
? Color(red: 0.95, green: 0.55, blue: 0.35)
: Color(red: 0.85, green: 0.45, blue: 0.25)
case "copilot":
secondaryColor = scheme == .dark
? Color(red: 0.55, green: 0.40, blue: 0.90)
: Color(red: 0.45, green: 0.30, blue: 0.80)
case "antigravity":
secondaryColor = scheme == .dark
? Color(red: 0.45, green: 0.25, blue: 0.75)
: Color(red: 0.35, green: 0.15, blue: 0.65)
case "zai":
secondaryColor = scheme == .dark
? Color(red: 0.30, green: 0.45, blue: 0.85)
: Color(red: 0.20, green: 0.35, blue: 0.75)
case "bedrock":
secondaryColor = scheme == .dark
? Color(red: 0.85, green: 0.45, blue: 0.15)
: Color(red: 0.75, green: 0.35, blue: 0.1)
case "ampcode":
secondaryColor = scheme == .dark
? Color(red: 0.85, green: 0.20, blue: 0.15)
: Color(red: 0.80, green: 0.15, blue: 0.10)
case "kimi":
secondaryColor = scheme == .dark
? Color(red: 0.20, green: 0.50, blue: 0.80)
: Color(red: 0.10, green: 0.40, blue: 0.70)
case "kiro":
secondaryColor = scheme == .dark
? Color(red: 0.70, green: 0.45, blue: 0.95)
: Color(red: 0.60, green: 0.35, blue: 0.85)
case "minimax":
secondaryColor = scheme == .dark
? Color(red: 0.96, green: 0.53, blue: 0.24)
: Color(red: 0.86, green: 0.43, blue: 0.14)
default:
return LinearGradient(
colors: [BaseTheme.coralAccent, BaseTheme.pinkHot],
startPoint: .leading,
endPoint: .trailing
)
}
return LinearGradient(
colors: [primaryColor, secondaryColor],
startPoint: .topLeading,
endPoint: .bottomTrailing
)
}
/// Get provider icon asset name by ID
static func iconAssetName(for providerId: String) -> String {
switch providerId {
case "claude": return "ClaudeIcon"
case "codex": return "CodexIcon"
case "gemini": return "GeminiIcon"
case "copilot": return "CopilotIcon"
case "antigravity": return "AntigravityIcon"
case "zai": return "ZaiIcon"
case "bedrock": return "BedrockIcon"
case "ampcode": return "AmpCodeIcon"
case "kimi": return "KimiIcon"
case "kiro": return "KiroIcon"
case "minimax": return "MiniMaxIcon"
default: return "QuestionIcon"
}
}
/// Get provider display name by ID
static func name(for providerId: String) -> String {
switch providerId {
case "claude": return "Claude"
case "codex": return "Codex"
case "gemini": return "Gemini"
case "copilot": return "GitHub Copilot"
case "antigravity": return "Antigravity"
case "zai": return "Z.ai"
case "bedrock": return "AWS Bedrock"
case "ampcode": return "Amp"
case "kimi": return "Kimi"
case "kiro": return "Kiro"
case "minimax": return "MiniMax"
default: return providerId.capitalized
}
}
/// Get provider SF symbol icon by ID
static func symbolIcon(for providerId: String) -> String {
switch providerId {
case "claude": return "brain.fill"
case "codex": return "chevron.left.forwardslash.chevron.right"
case "gemini": return "sparkles"
case "copilot": return "chevron.left.forwardslash.chevron.right"
case "antigravity": return "wand.and.stars"
case "zai": return "z.square.fill"
case "bedrock": return "cloud.fill"
case "ampcode": return "bolt.fill"
case "kimi": return "k.square.fill"
case "kiro": return "wand.and.stars.inverse"
case "minimax": return "waveform"
default: return "questionmark.circle.fill"
}
}
}