crossmate

A collaborative crossword app for iOS
Log | Files | Refs | LICENSE

commit cdb6cda7419b41cc07f72d2fa2324ce3506caa81
parent f13370af31fff7a5e5978d206499e4930803fb0e
Author: Michael Camilleri <[email protected]>
Date:   Thu, 21 May 2026 16:23:40 +0900

Thread tint colour consistently to SwiftUI views

Diffstat:
MCrossmate/Models/PlayerColor.swift | 3+++
MCrossmate/Views/ClueList.swift | 8++++++--
MCrossmate/Views/PuzzleView.swift | 6++----
3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/Crossmate/Models/PlayerColor.swift b/Crossmate/Models/PlayerColor.swift @@ -30,6 +30,9 @@ struct PlayerColor: Sendable, Identifiable, Hashable { /// Fill for UI tied to this player's passive highlight — the rest of the /// active word. var highlightFill: Color { tint.opacity(highlightedOpacity) } + + /// Fill for UI tied to faint author-attribution tinting. + var authorTintFill: Color { tint.opacity(Self.authorTintOpacity) } } extension PlayerColor { diff --git a/Crossmate/Views/ClueList.swift b/Crossmate/Views/ClueList.swift @@ -12,6 +12,10 @@ struct ClueList: View { case sidebar } + private var currentClueBackground: Color { + preferences.color.authorTintFill + } + var body: some View { switch presentation { case .sheet: @@ -175,7 +179,7 @@ struct ClueList: View { .contentShape(Rectangle()) } .buttonStyle(.plain) - .background(isCurrent ? preferences.color.highlightFill : Color.clear) + .background(isCurrent ? currentClueBackground : Color.clear) } private func rowID(direction: Puzzle.Direction, number: Int) -> String { @@ -212,6 +216,6 @@ struct ClueList: View { } .buttonStyle(.plain) .listRowInsets(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0)) - .listRowBackground(isCurrent ? preferences.color.highlightFill : Color.clear) + .listRowBackground(isCurrent ? currentClueBackground : Color.clear) } } diff --git a/Crossmate/Views/PuzzleView.swift b/Crossmate/Views/PuzzleView.swift @@ -1361,9 +1361,7 @@ private struct ClueBar: View { @State private var slideEdge: Edge = .trailing @State private var isShowingClueList = false - private var playerColor: PlayerColor { preferences.color } - private var backgroundTint: Color { playerColor.tint } - private var backgroundOpacity: Double { PlayerColor.authorTintOpacity } + private var backgroundColor: Color { preferences.color.authorTintFill } var body: some View { let clue = session.currentClue() @@ -1389,7 +1387,7 @@ private struct ClueBar: View { session.toggleDirection() } ) - .background(backgroundTint.opacity(backgroundOpacity)) + .background(backgroundColor) .animation(.smooth(duration: 0.22), value: currentKey) .sheet(isPresented: $isShowingClueList) { ClueList(session: session)