Build-Fix: KitColor statt RGBColor (Namenskonflikt mit QuickDraw), öffentlicher JerseySuggestion-Init, k-means vereinfacht, CGFloat→Double; Warnungen (NSLock in async, Captures)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012bGzgsxrmbBhDzeMV2L57D
This commit is contained in:
Lichtkasten DevandClaude Opus 5.5 committed 2026-11-04 01:16:47 +00:00
1 parent 9dcef7bd88
commit 3aa5bdef0e
6 files changed
+72 -40

No files matched your search

@@ -111,21 +111,21 @@ struct JerseySetupView: View {
private func add(_ set: CodeSet) {
let prefix = JerseyLogic.detectPrefix(codes: set.entries.map(\.code))
// first team light, second dark as a starting point – adjust with the picker
let defaults = [RGBColor(r: 0.1, g: 0.45, b: 0.25), RGBColor(r: 0.95, g: 0.95, b: 0.95), RGBColor(r: 0.1, g: 0.2, b: 0.6)]
let defaults = [KitColor(r: 0.1, g: 0.45, b: 0.25), KitColor(r: 0.95, g: 0.95, b: 0.95), KitColor(r: 0.1, g: 0.2, b: 0.6)]
let color = defaults[min(state.settings.jersey.teams.count, defaults.count - 1)]
state.settings.jersey.teams.append(JerseyTeam(name: set.name, codeSetID: set.id, prefix: prefix, shirtColor: color))
}
private func cg(_ c: RGBColor) -> CGColor { CGColor(srgbRed: c.r, green: c.g, blue: c.b, alpha: 1) }
private func cg(_ c: KitColor) -> CGColor { CGColor(srgbRed: c.r, green: c.g, blue: c.b, alpha: 1) }
private func rgb(_ c: CGColor) -> RGBColor {
private func rgb(_ c: CGColor) -> KitColor {
let conv = c.converted(to: CGColorSpace(name: CGColorSpace.sRGB)!, intent: .defaultIntent, options: nil) ?? c
let comps = conv.components ?? [0, 0, 0]
if comps.count >= 3 { return RGBColor(r: Double(comps[0]), g: Double(comps[1]), b: Double(comps[2])) }
return RGBColor(r: Double(comps[0]), g: Double(comps[0]), b: Double(comps[0])) // grayscale
if comps.count >= 3 { return KitColor(r: Double(comps[0]), g: Double(comps[1]), b: Double(comps[2])) }
return KitColor(r: Double(comps[0]), g: Double(comps[0]), b: Double(comps[0])) // grayscale
}
private func cgBinding(_ b: Binding<RGBColor>) -> Binding<CGColor> {
private func cgBinding(_ b: Binding<KitColor>) -> Binding<CGColor> {
Binding(get: { cg(b.wrappedValue) }, set: { b.wrappedValue = rgb($0) })
}
}