Commit 58f3b73e8f

58f3b73e8ff337e5a15111fbb32c0d57cf2346da

parent: 2c99274b57

Verified · cmc

cmc <hello@cleberg.net> · 2026-11-22 20:55 UTC

Agenda: keyword pills under Increase Contrast and Differentiate Without Colour

On the Mac and iOS, Increase Contrast fills keyword and priority badges
with their colour and draws the label in the background colour, and
the Mac's tag outlines go to full strength. Differentiate Without
Colour outlines keyword badges and puts a check mark before a done
keyword.

Ref #221

Layout: unified · split

Sources/Orgstar/AgendaRowView.swift +22 −10
@@ -18,6 +18,8 @@ struct AgendaRowView: View {
18 var marked = false 18 var marked = false
19 @Environment(\.orgTheme) private var theme 19 @Environment(\.orgTheme) private var theme
20 @ScaledMetric(relativeTo: .callout) private var gutterWidth = AgendaRowView.gutterWidth 20 @ScaledMetric(relativeTo: .callout) private var gutterWidth = AgendaRowView.gutterWidth
21 @Environment(\.colorSchemeContrast) private var contrast
22 @Environment(\.accessibilityDifferentiateWithoutColor) private var withoutColor
21 @ScaledMetric(relativeTo: .caption) private var badgeSize: CGFloat = 18 23 @ScaledMetric(relativeTo: .caption) private var badgeSize: CGFloat = 18
22 24
23 static let gutterWidth: CGFloat = 92 25 static let gutterWidth: CGFloat = 92
@@ -60,6 +62,11 @@ struct AgendaRowView: View {
60 .accessibilityElement(children: .combine) 62 .accessibilityElement(children: .combine)
61 } 63 }
62 64
65 /// Increase Contrast: keyword and priority badges are filled with their colour, tags outlined in full.
66 private var highContrast: Bool { contrast == .increased }
67
68 private var background: Color { theme.color("agenda-background") ?? Color(nsColor: .textBackgroundColor) }
69
63 private var statusColor: Color { 70 private var statusColor: Color {
64 theme.dynamic(.secondaryLabelColor) { [theme, row] in theme.statusColor(row.status, dark: $0) } 71 theme.dynamic(.secondaryLabelColor) { [theme, row] in theme.statusColor(row.status, dark: $0) }
65 } 72 }
@@ -127,7 +134,7 @@ struct AgendaRowView: View {
127 .foregroundStyle(theme.color("tags") ?? .secondary) 134 .foregroundStyle(theme.color("tags") ?? .secondary)
128 .padding(.horizontal, 6) 135 .padding(.horizontal, 6)
129 .padding(.vertical, 1) 136 .padding(.vertical, 1)
130 .background(Capsule().strokeBorder((theme.color("tags") ?? .secondary).opacity(0.35), lineWidth: 0.5)) 137 .background(Capsule().strokeBorder((theme.color("tags") ?? .secondary).opacity(highContrast ? 1 : 0.35), lineWidth: highContrast ? 1 : 0.5))
131 } 138 }
132 } 139 }
133 } 140 }
@@ -137,12 +144,17 @@ struct AgendaRowView: View {
137 HStack(spacing: 6) { 144 HStack(spacing: 6) {
138 if let todo = row.todo { 145 if let todo = row.todo {
139 let color = theme.dynamic(row.isDone ? .systemGreen : .systemRed) { [theme, row] in theme.todoColor(todo, isDone: row.isDone, dark: $0) } 146 let color = theme.dynamic(row.isDone ? .systemGreen : .systemRed) { [theme, row] in theme.todoColor(todo, isDone: row.isDone, dark: $0) }
140 Text(todo) 147 HStack(spacing: 2) {
141 .font(.caption.weight(.bold)) 148 // Done or not without telling green from red.
142 .foregroundStyle(color) 149 if withoutColor, row.isDone { Image(systemName: "checkmark") }
143 .padding(.horizontal, 7) 150 Text(todo)
144 .padding(.vertical, 2) 151 }
145 .background(Capsule().fill(color.opacity(0.14))) 152 .font(.caption.weight(.bold))
153 .foregroundStyle(highContrast ? background : color)
154 .padding(.horizontal, 7)
155 .padding(.vertical, 2)
156 .background(Capsule().fill(highContrast ? color : color.opacity(0.14)))
157 .overlay { if withoutColor, !highContrast { Capsule().strokeBorder(color, lineWidth: 1) } }
146 } 158 }
147 priorityBadge 159 priorityBadge
148 } 160 }
@@ -155,10 +167,10 @@ struct AgendaRowView: View {
155 let color = theme.dynamic(.systemOrange) { [theme] in theme.priorityColor(priority, dark: $0) } 167 let color = theme.dynamic(.systemOrange) { [theme] in theme.priorityColor(priority, dark: $0) }
156 Text(priority) 168 Text(priority)
157 .font(.caption.weight(.bold)) 169 .font(.caption.weight(.bold))
158 .foregroundStyle(color) 170 .foregroundStyle(highContrast ? background : color)
159 .frame(width: badgeSize, height: badgeSize) 171 .frame(width: badgeSize, height: badgeSize)
160 .background(Circle().fill(color.opacity(0.14))) 172 .background(Circle().fill(highContrast ? color : color.opacity(0.14)))
161 .overlay(Circle().strokeBorder(color.opacity(0.6), lineWidth: 1)) 173 .overlay(Circle().strokeBorder(color.opacity(highContrast ? 1 : 0.6), lineWidth: 1))
162 .help("Priority \(priority)") 174 .help("Priority \(priority)")
163 } else { 175 } else {
164 Color.clear.frame(width: badgeSize, height: badgeSize) 176 Color.clear.frame(width: badgeSize, height: badgeSize)
Sources/OrgstarMobile/AgendaScreen.swift +17 −7
@@ -959,6 +959,11 @@ struct AgendaRowView: View {
959 @Environment(\.dynamicTypeSize) private var typeSize 959 @Environment(\.dynamicTypeSize) private var typeSize
960 @ScaledMetric(relativeTo: .subheadline) private var gutterWidth: CGFloat = 82 960 @ScaledMetric(relativeTo: .subheadline) private var gutterWidth: CGFloat = 82
961 @ScaledMetric(relativeTo: .caption2) private var badgeSize: CGFloat = 18 961 @ScaledMetric(relativeTo: .caption2) private var badgeSize: CGFloat = 18
962 @Environment(\.colorSchemeContrast) private var contrast
963 @Environment(\.accessibilityDifferentiateWithoutColor) private var withoutColor
964
965 /// Increase Contrast: keyword and priority badges are filled with their colour.
966 private var highContrast: Bool { contrast == .increased }
962 967
963 /// TODO and match lists have no times or statuses. 968 /// TODO and match lists have no times or statuses.
964 private var hasGutter: Bool { !row.gutter.isEmpty || row.icon != nil } 969 private var hasGutter: Bool { !row.gutter.isEmpty || row.icon != nil }
@@ -1026,19 +1031,24 @@ struct AgendaRowView: View {
1026 HStack(spacing: 5) { 1031 HStack(spacing: 5) {
1027 if let todo = row.todo { 1032 if let todo = row.todo {
1028 let color = theme.todoColor(todo, isDone: row.isDone, dark: dark)?.swiftUI ?? .secondary 1033 let color = theme.todoColor(todo, isDone: row.isDone, dark: dark)?.swiftUI ?? .secondary
1029 Text(todo) 1034 HStack(spacing: 2) {
1030 .font(.caption2.weight(.semibold)) 1035 // Done or not without telling green from red.
1031 .foregroundStyle(color) 1036 if withoutColor, row.isDone { Image(systemName: "checkmark") }
1032 .padding(.horizontal, 6).padding(.vertical, 2) 1037 Text(todo)
1033 .background(color.opacity(0.14), in: Capsule()) 1038 }
1039 .font(.caption2.weight(.semibold))
1040 .foregroundStyle(highContrast ? Color(.systemBackground) : color)
1041 .padding(.horizontal, 6).padding(.vertical, 2)
1042 .background(highContrast ? color : color.opacity(0.14), in: Capsule())
1043 .overlay { if withoutColor, !highContrast { Capsule().strokeBorder(color, lineWidth: 1) } }
1034 } 1044 }
1035 if let priority = row.priority { 1045 if let priority = row.priority {
1036 let color = theme.priorityColor(priority, dark: dark)?.swiftUI ?? .orange 1046 let color = theme.priorityColor(priority, dark: dark)?.swiftUI ?? .orange
1037 Text(priority) 1047 Text(priority)
1038 .font(.caption2.weight(.bold)) 1048 .font(.caption2.weight(.bold))
1039 .foregroundStyle(color) 1049 .foregroundStyle(highContrast ? Color(.systemBackground) : color)
1040 .frame(width: badgeSize, height: badgeSize) 1050 .frame(width: badgeSize, height: badgeSize)
1041 .background(color.opacity(0.14), in: Circle()) 1051 .background(highContrast ? color : color.opacity(0.14), in: Circle())
1042 .overlay(Circle().strokeBorder(color, lineWidth: 1.2)) 1052 .overlay(Circle().strokeBorder(color, lineWidth: 1.2))
1043 .accessibilityLabel("Priority \(priority)") 1053 .accessibilityLabel("Priority \(priority)")
1044 } 1054 }
docs/manual/guide/07-agenda.org +2
@@ -185,6 +185,8 @@ Rows look the same on the Mac and iOS. Each shows:
185- The title: the heading without its TODO keyword, priority cookie, statistics cookies, timestamps and tags, with links shown as their descriptions. A done entry's title is struck through. 185- The title: the heading without its TODO keyword, priority cookie, statistics cookies, timestamps and tags, with links shown as their descriptions. A done entry's title is struck through.
186- Under the title, the habit's consistency graph, for habits. 186- Under the title, the habit's consistency graph, for habits.
187 187
188With Increase Contrast on in the system's accessibility settings, the keyword and priority badges are filled with their color, and on the Mac tags have a full outline. With Differentiate Without Color on, keyword badges are outlined and a done keyword shows a check mark.
189
188The status sets the color of the left column: 190The status sets the color of the left column:
189 191
190| Status | When | Theme key | 192| Status | When | Theme key |