Commit 9662bddcfb

9662bddcfbd1203c3a448ee0cb73161c76610b6b

parent: 7e86cdaf6e

Verified · cmc

cmc <hello@cleberg.net> · 2026-11-25 22:14 UTC

Diff and board under Increase Contrast and Differentiate Without Colour

Comparisons label each changed line Removed or Added for VoiceOver,
and in words beside the line under Differentiate Without Colour; under
Increase Contrast the tint is stronger and a solid bar marks each
changed line. Board cards: the selected card has an accent outline,
heavier under Increase Contrast, which also outlines every card and
draws category, tags and dates in the theme's foreground. The
inspector's table and list use the system's selection.

Ref #221

Layout: unified · split

Changed files (5)
Sources/OrgApp/DiffView.swift +39 −6 · view
@@ -9,6 +9,9 @@ public struct DiffView: View {
9 let addedColor: Color 9 let addedColor: Color
10 let foreground: Color? 10 let foreground: Color?
11 let background: Color? 11 let background: Color?
12 @Environment(\.colorSchemeContrast) private var contrast
13 @Environment(\.accessibilityDifferentiateWithoutColor) private var withoutColor
14 @ScaledMetric(relativeTo: .caption) private var wordWidth: CGFloat = 64
12 15
13 /// `removed` and `added` tint the changed lines; `foreground` and `background` default to 16 /// `removed` and `added` tint the changed lines; `foreground` and `background` default to
14 /// the system's text colours. 17 /// the system's text colours.
@@ -47,9 +50,7 @@ public struct DiffView: View {
47 if shown.isEmpty { Text("No differences").foregroundStyle(.secondary).padding(8) } 50 if shown.isEmpty { Text("No differences").foregroundStyle(.secondary).padding(8) }
48 ForEach(shown.indices, id: \.self) { i in 51 ForEach(shown.indices, id: \.self) { i in
49 if let line = shown[i] { 52 if let line = shown[i] {
50 Text(prefix(line.kind) + line.text.trimmingCharacters(in: .newlines)) 53 row(line)
51 .frame(maxWidth: .infinity, alignment: .leading)
52 .background(background(line.kind))
53 } else { 54 } else {
54 Text("⋯").foregroundStyle(.secondary) 55 Text("⋯").foregroundStyle(.secondary)
55 } 56 }
@@ -72,6 +73,29 @@ public struct DiffView: View {
72 #endif 73 #endif
73 } 74 }
74 75
76 private func row(_ line: DiffLine) -> some View {
77 let text = line.text.trimmingCharacters(in: .newlines)
78 return HStack(spacing: 0) {
79 // Differentiate Without Colour: the change in words before the line.
80 if withoutColor {
81 Text(word(line.kind) ?? "")
82 .font(.caption.weight(.semibold))
83 .frame(width: wordWidth, alignment: .leading)
84 }
85 Text(prefix(line.kind) + text)
86 }
87 .frame(maxWidth: .infinity, alignment: .leading)
88 .background(tint(line.kind))
89 .overlay(alignment: .leading) {
90 // Increase Contrast: a solid bar at the edge of each changed line.
91 if contrast == .increased, line.kind != .same {
92 Rectangle().fill(line.kind == .removed ? removedColor : addedColor).frame(width: 3)
93 }
94 }
95 .accessibilityElement(children: .ignore)
96 .accessibilityLabel(word(line.kind).map { "\($0): \(text)" } ?? text)
97 }
98
75 private func prefix(_ kind: DiffLine.Kind) -> String { 99 private func prefix(_ kind: DiffLine.Kind) -> String {
76 switch kind { 100 switch kind {
77 case .same: " " 101 case .same: " "
@@ -80,11 +104,20 @@ public struct DiffView: View {
80 } 104 }
81 } 105 }
82 106
83 private func background(_ kind: DiffLine.Kind) -> Color { 107 private func word(_ kind: DiffLine.Kind) -> String? {
84 switch kind { 108 switch kind {
109 case .same: nil
110 case .removed: String(localized: "diff.removed", defaultValue: "Removed", comment: "A line removed, in a comparison of two versions")
111 case .added: String(localized: "diff.added", defaultValue: "Added", comment: "A line added, in a comparison of two versions")
112 }
113 }
114
115 private func tint(_ kind: DiffLine.Kind) -> Color {
116 let strength = contrast == .increased ? 0.35 : 0.18
117 return switch kind {
85 case .same: .clear 118 case .same: .clear
86 case .removed: removedColor.opacity(0.18) 119 case .removed: removedColor.opacity(strength)
87 case .added: addedColor.opacity(0.18) 120 case .added: addedColor.opacity(strength)
88 } 121 }
89 } 122 }
90} 123}
Sources/Orgstar/BoardView.swift +15 −4 · view
@@ -28,6 +28,7 @@ struct BoardView: View {
28 @Environment(\.openWindow) private var openWindow 28 @Environment(\.openWindow) private var openWindow
29 @Environment(\.orgTheme) private var theme 29 @Environment(\.orgTheme) private var theme
30 @Environment(\.colorScheme) private var colorScheme 30 @Environment(\.colorScheme) private var colorScheme
31 @Environment(\.colorSchemeContrast) private var contrast
31 32
32 init(workspace: WorkspaceModel, session: DocumentSession, commands: AppCommands) { 33 init(workspace: WorkspaceModel, session: DocumentSession, commands: AppCommands) {
33 self.workspace = workspace 34 self.workspace = workspace
@@ -233,9 +234,9 @@ struct BoardView: View {
233 Text((entry.priority.map { "[#\($0)] " } ?? "") + entry.title).lineLimit(3) 234 Text((entry.priority.map { "[#\($0)] " } ?? "") + entry.title).lineLimit(3)
234 .foregroundStyle(theme.color("foreground") ?? .primary) 235 .foregroundStyle(theme.color("foreground") ?? .primary)
235 HStack(spacing: 6) { 236 HStack(spacing: 6) {
236 Text(entry.category).font(.caption).foregroundStyle(theme.color("agenda-category") ?? .secondary) 237 Text(entry.category).font(.caption).foregroundStyle(secondary("agenda-category"))
237 if !entry.tags.isEmpty { 238 if !entry.tags.isEmpty {
238 Text(entry.tags.joined(separator: " ")).font(.caption).foregroundStyle(theme.color("tags") ?? .secondary).lineLimit(1) 239 Text(entry.tags.joined(separator: " ")).font(.caption).foregroundStyle(secondary("tags")).lineLimit(1)
239 } 240 }
240 } 241 }
241 if let deadline = entry.deadline { 242 if let deadline = entry.deadline {
@@ -243,17 +244,27 @@ struct BoardView: View {
243 let overdue = deadline.prefix(10) < Date().formatted(Date.ISO8601FormatStyle(timeZone: .current).year().month().day()) 244 let overdue = deadline.prefix(10) < Date().formatted(Date.ISO8601FormatStyle(timeZone: .current).year().month().day())
244 Text("Deadline \(deadline)").font(.caption).foregroundStyle(theme.color(overdue ? "agenda-overdue" : "agenda-due-soon") ?? .red) 245 Text("Deadline \(deadline)").font(.caption).foregroundStyle(theme.color(overdue ? "agenda-overdue" : "agenda-due-soon") ?? .red)
245 } else if let scheduled = entry.scheduled { 246 } else if let scheduled = entry.scheduled {
246 Text("Scheduled \(scheduled)").font(.caption).foregroundStyle(theme.color("agenda-time") ?? .secondary) 247 Text("Scheduled \(scheduled)").font(.caption).foregroundStyle(secondary("agenda-time"))
247 } 248 }
248 } 249 }
249 .padding(8) 250 .padding(8)
250 .frame(maxWidth: .infinity, alignment: .leading) 251 .frame(maxWidth: .infinity, alignment: .leading)
251 .background(RoundedRectangle(cornerRadius: 6).fill(theme.color("block-background") ?? Color(nsColor: .controlBackgroundColor))) 252 .background(RoundedRectangle(cornerRadius: 6).fill(theme.color("block-background") ?? Color(nsColor: .controlBackgroundColor)))
252 .overlay { 253 .overlay {
253 if selected { RoundedRectangle(cornerRadius: 6).strokeBorder(theme.color("accent") ?? .accentColor, lineWidth: 2) } 254 // Increase Contrast: a full outline on every card and a heavier one on the selected card.
255 if selected {
256 RoundedRectangle(cornerRadius: 6).strokeBorder(theme.color("accent") ?? .accentColor, lineWidth: contrast == .increased ? 3 : 2)
257 } else if contrast == .increased {
258 RoundedRectangle(cornerRadius: 6).strokeBorder(Color.primary.opacity(0.6), lineWidth: 1)
259 }
254 } 260 }
255 } 261 }
256 262
263 /// A secondary text colour from the theme; the foreground under Increase Contrast.
264 private func secondary(_ key: String) -> Color {
265 contrast == .increased ? theme.color("foreground") ?? .primary : theme.color(key) ?? .secondary
266 }
267
257 /// A keyword's colour as the agenda draws it: its own, else its class's (NEXT, WAIT, …). 268 /// A keyword's colour as the agenda draws it: its own, else its class's (NEXT, WAIT, …).
258 private func keywordColor(_ keyword: String, done: Bool) -> Color { 269 private func keywordColor(_ keyword: String, done: Bool) -> Color {
259 theme.dynamic(done ? .systemGreen : .systemRed) { [theme] in theme.todoColor(keyword, isDone: done, dark: $0) } 270 theme.dynamic(done ? .systemGreen : .systemRed) { [theme] in theme.todoColor(keyword, isDone: done, dark: $0) }
docs/manual/guide/01-files-and-folders.org +1 −1 · view
@@ -247,7 +247,7 @@ To throw away your unsaved edits and load the file as it is on disk, choose File
247 247
248** Conflicts 248** Conflicts
249 249
250When a buffer conflicts with its file, automatic saving stops for that buffer, the =Conflict= button appears in the toolbar, and the conflict sheet opens. The sheet shows the differences: lines marked =-= are on disk, lines marked =+= are in your version, with three lines of context around each change. Removed lines are tinted in the theme's =todo= color and added lines in its =done= color. Choose: 250When a buffer conflicts with its file, automatic saving stops for that buffer, the =Conflict= button appears in the toolbar, and the conflict sheet opens. The sheet shows the differences: lines marked =-= are on disk, lines marked =+= are in your version, with three lines of context around each change. Removed lines are tinted in the theme's =todo= color and added lines in its =done= color. With Differentiate Without Color on in the system's accessibility settings, each changed line is also labelled Removed or Added; with Increase Contrast on, the tint is stronger and a bar marks each changed line. VoiceOver reads each changed line with Removed or Added before it. Choose:
251 251
252| Button | What it does | 252| Button | What it does |
253|--------------------+------------------------------------------------------------------------------------------------------------------| 253|--------------------+------------------------------------------------------------------------------------------------------------------|
docs/manual/guide/07-agenda.org +2 · view
@@ -706,6 +706,8 @@ Each TODO keyword your files use gets a column, in sequence order, done keywords
706 706
707From the keyboard, click a card or press an arrow key to select one. The arrow keys move between cards, =Return= opens the selected card's entry, and =⇧←= and =⇧→= move it to the column before or after, as dragging does. 707From the keyboard, click a card or press an arrow key to select one. The arrow keys move between cards, =Return= opens the selected card's entry, and =⇧←= and =⇧→= move it to the column before or after, as dragging does.
708 708
709With Increase Contrast on, cards have an outline, the selected card a heavier one, and the category, tags and dates are drawn in the theme's =foreground=.
710
709With a match that includes entries without a TODO keyword, those entries appear in the table but not on the kanban board, which has no column for them. 711With a match that includes entries without a TODO keyword, those entries appear in the table but not on the kanban board, which has no column for them.
710 712
711** On iOS 713** On iOS
l10n/Localizable.xcstrings +82 · view
@@ -40826,6 +40826,88 @@
40826 } 40826 }
40827 } 40827 }
40828 }, 40828 },
40829 "diff.added": {
40830 "comment": "A line added, in a comparison of two versions",
40831 "localizations": {
40832 "de": {
40833 "stringUnit": {
40834 "state": "translated",
40835 "value": "Hinzugefügt"
40836 }
40837 },
40838 "en": {
40839 "stringUnit": {
40840 "state": "translated",
40841 "value": "Added"
40842 }
40843 },
40844 "es": {
40845 "stringUnit": {
40846 "state": "translated",
40847 "value": "Añadida"
40848 }
40849 },
40850 "fr": {
40851 "stringUnit": {
40852 "state": "translated",
40853 "value": "Ajoutée"
40854 }
40855 },
40856 "ja": {
40857 "stringUnit": {
40858 "state": "translated",
40859 "value": "追加"
40860 }
40861 },
40862 "pt-BR": {
40863 "stringUnit": {
40864 "state": "translated",
40865 "value": "Adicionada"
40866 }
40867 }
40868 }
40869 },
40870 "diff.removed": {
40871 "comment": "A line removed, in a comparison of two versions",
40872 "localizations": {
40873 "de": {
40874 "stringUnit": {
40875 "state": "translated",
40876 "value": "Entfernt"
40877 }
40878 },
40879 "en": {
40880 "stringUnit": {
40881 "state": "translated",
40882 "value": "Removed"
40883 }
40884 },
40885 "es": {
40886 "stringUnit": {
40887 "state": "translated",
40888 "value": "Eliminada"
40889 }
40890 },
40891 "fr": {
40892 "stringUnit": {
40893 "state": "translated",
40894 "value": "Supprimée"
40895 }
40896 },
40897 "ja": {
40898 "stringUnit": {
40899 "state": "translated",
40900 "value": "削除"
40901 }
40902 },
40903 "pt-BR": {
40904 "stringUnit": {
40905 "state": "translated",
40906 "value": "Removida"
40907 }
40908 }
40909 }
40910 },
40829 "division by zero": { 40911 "division by zero": {
40830 "localizations": { 40912 "localizations": {
40831 "de": { 40913 "de": {
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form