commit 392b1bce068e6c348d3301719573ea14caaddc0a
parent a3c5f45ceeb5359eded0c43a2f19bb2f1769f785
Author: Michael Camilleri <[email protected]>
Date: Tue, 14 Apr 2026 06:26:56 +0900
Change colours used in clue bar and start squares
Diffstat:
3 files changed, 35 insertions(+), 7 deletions(-)
diff --git a/Crossmate/Models/PlayerColor.swift b/Crossmate/Models/PlayerColor.swift
@@ -13,6 +13,13 @@ struct PlayerColor: Sendable, Identifiable, Hashable {
/// Opacity used for the rest of this player's active word.
var highlightedOpacity: Double { 0.18 }
+
+ /// Fill for UI tied to this player's active selection (the selected cell).
+ var selectionFill: Color { tint.opacity(selectedOpacity) }
+
+ /// Fill for UI tied to this player's passive highlight — the rest of the
+ /// active word and the clue bar. Change this to retint both at once.
+ var highlightFill: Color { tint.opacity(highlightedOpacity) }
}
extension PlayerColor {
diff --git a/Crossmate/Views/CellView.swift b/Crossmate/Views/CellView.swift
@@ -20,8 +20,8 @@ struct CellView: View {
.padding(1.5)
}
if cell.number != nil {
- CornerTriangle(corner: .topLeading)
- .fill(Color.orange)
+ CornerDot()
+ .fill(Color(.systemGray3))
}
Text(entry)
.font(.system(size: 34, weight: .semibold, design: .rounded))
@@ -76,15 +76,36 @@ struct CellView: View {
Color.black.opacity(0.18)
}
if isSelected {
- playerColor.tint.opacity(playerColor.selectedOpacity)
+ playerColor.selectionFill
} else if isHighlighted {
- playerColor.tint.opacity(playerColor.highlightedOpacity)
+ playerColor.highlightFill
}
}
}
}
}
+/// Small dot pinned to the top-leading corner of the cell, sized as a
+/// fraction of the shorter cell dimension. Marks cells that start a word.
+private struct CornerDot: Shape {
+ var diameterFraction: CGFloat = 0.15
+ var insetFraction: CGFloat = 0.05
+
+ func path(in rect: CGRect) -> Path {
+ let side = min(rect.width, rect.height)
+ let diameter = side * diameterFraction
+ let inset = side * insetFraction
+ var path = Path()
+ path.addEllipse(in: CGRect(
+ x: rect.minX + inset,
+ y: rect.minY + inset,
+ width: diameter,
+ height: diameter
+ ))
+ return path
+ }
+}
+
/// Right-angled triangle pinned to the top-right corner of the cell, sized
/// as a fraction of the shorter cell dimension. Used as a small marker for
/// revealed and checkedWrong cells.
diff --git a/Crossmate/Views/PuzzleView.swift b/Crossmate/Views/PuzzleView.swift
@@ -50,8 +50,7 @@ struct PuzzleView: View {
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity)
.padding(.horizontal)
- .padding(.top, 8)
- .padding(.bottom, 14)
+ .padding(.bottom, 12)
GridView(session: session)
Spacer(minLength: 12)
}
@@ -127,6 +126,7 @@ private struct ClueKey: Hashable {
private struct ClueBar: View {
@Bindable var session: PlayerSession
+ @Environment(\.playerColor) private var playerColor
@State private var previousKey: ClueKey?
var body: some View {
@@ -173,7 +173,7 @@ private struct ClueBar: View {
}
.padding(.horizontal, 12)
.padding(.vertical, 12)
- .background(Color(.systemGroupedBackground))
+ .background(playerColor.highlightFill)
.animation(.smooth(duration: 0.22), value: currentKey)
.onChange(of: currentKey) { _, newValue in
previousKey = newValue