commit a8216ec129dd0b1f614bd165d148d595cb474432
parent 18134f4f82ee0cdbe3a1b30210e8881c3e5c9940
Author: Michael Camilleri <[email protected]>
Date: Sun, 3 May 2026 14:31:30 +0900
Use a faint background to differentiate authors
Colouring the letters was a bit garish. This commit applies a faint tint
to the squares by author.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
Diffstat:
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/Crossmate/Views/CellView.swift b/Crossmate/Views/CellView.swift
@@ -10,7 +10,7 @@ struct CellView: View, Equatable {
let specialKind: Puzzle.Special?
var remoteWordTint: Color? = nil
var remoteOutline: Color? = nil
- var letterColor: Color? = nil
+ var authorTint: Color? = nil
@Environment(PlayerPreferences.self) private var preferences
private var playerColor: PlayerColor { preferences.color }
@@ -25,7 +25,7 @@ struct CellView: View, Equatable {
&& lhs.specialKind == rhs.specialKind
&& lhs.remoteWordTint == rhs.remoteWordTint
&& lhs.remoteOutline == rhs.remoteOutline
- && lhs.letterColor == rhs.letterColor
+ && lhs.authorTint == rhs.authorTint
}
var body: some View {
@@ -75,14 +75,8 @@ struct CellView: View, Equatable {
private var entryStyle: AnyShapeStyle {
switch mark {
case .pencil:
- if let letterColor {
- return AnyShapeStyle(letterColor.opacity(0.55))
- }
return AnyShapeStyle(HierarchicalShapeStyle.secondary)
case .none, .pen, .revealed:
- if let letterColor {
- return AnyShapeStyle(letterColor)
- }
return AnyShapeStyle(HierarchicalShapeStyle.primary)
}
}
@@ -107,6 +101,12 @@ struct CellView: View, Equatable {
if cell.isSpecial && specialKind == .shaded {
Color.black.opacity(0.22)
}
+ // Faint background tint identifying who entered this letter
+ // in a shared game. Sits beneath transient highlights so peer
+ // and local cursors still dominate.
+ if let authorTint {
+ authorTint.opacity(0.18)
+ }
// Peer word tint sits beneath self highlight/selection so the
// local cursor always reads as the dominant focus.
if let remoteWordTint {
diff --git a/Crossmate/Views/GridView.swift b/Crossmate/Views/GridView.swift
@@ -13,9 +13,9 @@ struct GridView: View {
// value it needs. Multiple peers landing on the same cell collapse
// to the most recent.
let (outlineByCell, tintByCell) = remoteOverlays()
- // In shared games, colour each letter by its author. Single-player
- // games (`roster == nil`) keep the default primary/secondary styling.
- let letterColorByAuthor: [String: Color] = roster.map { roster in
+ // In shared games, faintly tint each cell's background by its
+ // letter's author. Single-player games (`roster == nil`) skip this.
+ let authorTintByID: [String: Color] = roster.map { roster in
Dictionary(
uniqueKeysWithValues: roster.entries.map { ($0.authorID, $0.color.tint) }
)
@@ -46,7 +46,7 @@ struct GridView: View {
specialKind: session.puzzle.specialKind,
remoteWordTint: tintByCell[pos],
remoteOutline: outlineByCell[pos],
- letterColor: square.letterAuthorID.flatMap { letterColorByAuthor[$0] }
+ authorTint: square.letterAuthorID.flatMap { authorTintByID[$0] }
)
.equatable()
.onTapGesture {