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 {
99 let addedColor: Color
1010 let foreground: Color?
1111 let background: Color?
12 @Environment(\.colorSchemeContrast) private var contrast
13 @Environment(\.accessibilityDifferentiateWithoutColor) private var withoutColor
14 @ScaledMetric(relativeTo: .caption) private var wordWidth: CGFloat = 64
1215
1316 /// `removed` and `added` tint the changed lines; `foreground` and `background` default to
1417 /// the system's text colours.
@@ -47,9 +50,7 @@ public struct DiffView: View {
4750 if shown.isEmpty { Text("No differences").foregroundStyle(.secondary).padding(8) }
4851 ForEach(shown.indices, id: \.self) { i in
4952 if let line = shown[i] {
50 Text(prefix(line.kind) + line.text.trimmingCharacters(in: .newlines))
51 .frame(maxWidth: .infinity, alignment: .leading)
52 .background(background(line.kind))
53 row(line)
5354 } else {
5455 Text("⋯").foregroundStyle(.secondary)
5556 }
@@ -72,6 +73,29 @@ public struct DiffView: View {
7273 #endif
7374 }
7475
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
7599 private func prefix(_ kind: DiffLine.Kind) -> String {
76100 switch kind {
77101 case .same: " "
@@ -80,11 +104,20 @@ public struct DiffView: View {
80104 }
81105 }
82106
83 private func background(_ kind: DiffLine.Kind) -> Color {
107 private func word(_ kind: DiffLine.Kind) -> String? {
84108 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 {
85118 case .same: .clear
86 case .removed: removedColor.opacity(0.18)
87 case .added: addedColor.opacity(0.18)
119 case .removed: removedColor.opacity(strength)
120 case .added: addedColor.opacity(strength)
88121 }
89122 }
90123}
Sources/Orgstar/BoardView.swift +15 −4 · view
@@ -28,6 +28,7 @@ struct BoardView: View {
2828 @Environment(\.openWindow) private var openWindow
2929 @Environment(\.orgTheme) private var theme
3030 @Environment(\.colorScheme) private var colorScheme
31 @Environment(\.colorSchemeContrast) private var contrast
3132
3233 init(workspace: WorkspaceModel, session: DocumentSession, commands: AppCommands) {
3334 self.workspace = workspace
@@ -233,9 +234,9 @@ struct BoardView: View {
233234 Text((entry.priority.map { "[#\($0)] " } ?? "") + entry.title).lineLimit(3)
234235 .foregroundStyle(theme.color("foreground") ?? .primary)
235236 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"))
237238 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)
239240 }
240241 }
241242 if let deadline = entry.deadline {
@@ -243,17 +244,27 @@ struct BoardView: View {
243244 let overdue = deadline.prefix(10) < Date().formatted(Date.ISO8601FormatStyle(timeZone: .current).year().month().day())
244245 Text("Deadline \(deadline)").font(.caption).foregroundStyle(theme.color(overdue ? "agenda-overdue" : "agenda-due-soon") ?? .red)
245246 } 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"))
247248 }
248249 }
249250 .padding(8)
250251 .frame(maxWidth: .infinity, alignment: .leading)
251252 .background(RoundedRectangle(cornerRadius: 6).fill(theme.color("block-background") ?? Color(nsColor: .controlBackgroundColor)))
252253 .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 }
254260 }
255261 }
256262
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
257268 /// A keyword's colour as the agenda draws it: its own, else its class's (NEXT, WAIT, …).
258269 private func keywordColor(_ keyword: String, done: Bool) -> Color {
259270 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
247247
248248** Conflicts
249249
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:
251251
252252| Button | What it does |
253253|--------------------+------------------------------------------------------------------------------------------------------------------|
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
706706
707707From 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.
708708
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
709711With 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.
710712
711713** On iOS
l10n/Localizable.xcstrings +82 · view
@@ -40826,6 +40826,88 @@
4082640826 }
4082740827 }
4082840828 },
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 },
4082940911 "division by zero": {
4083040912 "localizations": {
4083140913 "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