Commit 7e86cdaf6e

7e86cdaf6e6806ce6a715f7e497be77ee6260c17

parent: 8714ee0921

Verified · cmc

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

Board: keyword colours as in the agenda; theme colours in the diff and board

Board column headings and the table's TODO column use the agenda's
keyword colours, so NEXT and WAIT are no longer red. Cards take the
theme's foreground, block background, category, tag and time colours,
and a deadline is agenda-overdue when past and agenda-due-soon
otherwise. The Mac's conflict, sync-conflict and recovery comparisons
draw removed and added lines in the theme's todo and done colours on
its background.

Ref #223

Layout: unified · split

Changed files (6)
Sources/OrgApp/DiffView.swift +16 −5 · view
@@ -5,9 +5,19 @@ import SwiftUI
55public struct DiffView: View {
66 let lines: [DiffLine]
77 var context = 3
8 let removedColor: Color
9 let addedColor: Color
10 let foreground: Color?
11 let background: Color?
812
9 public init(old: String, new: String) {
13 /// `removed` and `added` tint the changed lines; `foreground` and `background` default to
14 /// the system's text colours.
15 public init(old: String, new: String, removed: Color = .red, added: Color = .green, foreground: Color? = nil, background: Color? = nil) {
1016 lines = lineDiff(old: old, new: new)
17 removedColor = removed
18 addedColor = added
19 self.foreground = foreground
20 self.background = background
1121 }
1222
1323 /// Lines to show, nil standing for a run of unchanged lines left out.
@@ -50,14 +60,15 @@ public struct DiffView: View {
5060 #else
5161 .font(.system(.footnote, design: .monospaced))
5262 #endif
63 .foregroundStyle(foreground ?? .primary)
5364 .textSelection(.enabled)
5465 .padding(8)
5566 }
5667 .defaultScrollAnchor(.topLeading)
5768 #if os(macOS)
58 .background(Color(nsColor: .textBackgroundColor))
69 .background(background ?? Color(nsColor: .textBackgroundColor))
5970 #else
60 .background(Color(uiColor: .secondarySystemBackground))
71 .background(background ?? Color(uiColor: .secondarySystemBackground))
6172 #endif
6273 }
6374
@@ -72,8 +83,8 @@ public struct DiffView: View {
7283 private func background(_ kind: DiffLine.Kind) -> Color {
7384 switch kind {
7485 case .same: .clear
75 case .removed: .red.opacity(0.18)
76 case .added: .green.opacity(0.18)
86 case .removed: removedColor.opacity(0.18)
87 case .added: addedColor.opacity(0.18)
7788 }
7889 }
7990}
Sources/Orgstar/BoardView.swift +15 −7 · view
@@ -96,7 +96,7 @@ struct BoardView: View {
9696 private var table: some View {
9797 Table(rows, selection: $selection, sortOrder: $sortOrder) {
9898 TableColumn("TODO", value: \.todoOrder) { row in
99 Text(row.entry.todo ?? "").foregroundStyle(theme.keywordColor(row.entry.todo ?? "", done: row.entry.isDone)).bold()
99 Text(row.entry.todo ?? "").foregroundStyle(keywordColor(row.entry.todo ?? "", done: row.entry.isDone)).bold()
100100 }
101101 .width(min: 50, ideal: 60, max: 90)
102102 TableColumn("P", value: \.priority) { row in Text(row.priority) }
@@ -188,7 +188,7 @@ struct BoardView: View {
188188 let cards = entries.filter { $0.todo == keyword }
189189 return VStack(alignment: .leading, spacing: 8) {
190190 HStack {
191 Text(keyword).font(.headline).foregroundStyle(theme.keywordColor(keyword, done: cards.first?.isDone ?? false))
191 Text(keyword).font(.headline).foregroundStyle(keywordColor(keyword, done: cards.first?.isDone ?? false))
192192 Text("\(cards.count)").foregroundStyle(.secondary)
193193 }
194194 ScrollView {
@@ -231,26 +231,34 @@ struct BoardView: View {
231231 let selected = current == entry.id
232232 return VStack(alignment: .leading, spacing: 4) {
233233 Text((entry.priority.map { "[#\($0)] " } ?? "") + entry.title).lineLimit(3)
234 .foregroundStyle(theme.color("foreground") ?? .primary)
234235 HStack(spacing: 6) {
235 Text(entry.category).font(.caption).foregroundStyle(.secondary)
236 Text(entry.category).font(.caption).foregroundStyle(theme.color("agenda-category") ?? .secondary)
236237 if !entry.tags.isEmpty {
237 Text(entry.tags.joined(separator: " ")).font(.caption).foregroundStyle(.secondary).lineLimit(1)
238 Text(entry.tags.joined(separator: " ")).font(.caption).foregroundStyle(theme.color("tags") ?? .secondary).lineLimit(1)
238239 }
239240 }
240241 if let deadline = entry.deadline {
241 Text("Deadline \(deadline)").font(.caption).foregroundStyle(.red)
242 // As the agenda colours a deadline: overdue when past, else due soon.
243 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)
242245 } else if let scheduled = entry.scheduled {
243 Text("Scheduled \(scheduled)").font(.caption).foregroundStyle(.secondary)
246 Text("Scheduled \(scheduled)").font(.caption).foregroundStyle(theme.color("agenda-time") ?? .secondary)
244247 }
245248 }
246249 .padding(8)
247250 .frame(maxWidth: .infinity, alignment: .leading)
248 .background(RoundedRectangle(cornerRadius: 6).fill(Color(nsColor: .controlBackgroundColor)))
251 .background(RoundedRectangle(cornerRadius: 6).fill(theme.color("block-background") ?? Color(nsColor: .controlBackgroundColor)))
249252 .overlay {
250253 if selected { RoundedRectangle(cornerRadius: 6).strokeBorder(theme.color("accent") ?? .accentColor, lineWidth: 2) }
251254 }
252255 }
253256
257 /// 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 {
259 theme.dynamic(done ? .systemGreen : .systemRed) { [theme] in theme.todoColor(keyword, isDone: done, dark: $0) }
260 }
261
254262 // MARK: - Editing
255263
256264 private func perform(_ command: any OrgCommand, on entry: BoardEntry, answers: [String: String] = [:]) {
Sources/Orgstar/VersionViews.swift +18 −3 · view
@@ -1,8 +1,23 @@
11import AppKit
22import OrgApp
33import OrgDocument
4import OrgPresentation
45import SwiftUI
56
7/// A diff in the theme's colours: removed lines in its TODO red, added ones in its DONE green.
8struct ThemedDiff: View {
9 let old: String
10 let new: String
11 @Environment(\.orgTheme) private var theme
12
13 var body: some View {
14 DiffView(
15 old: old, new: new, removed: theme.color("todo") ?? .red, added: theme.color("done") ?? .green,
16 foreground: theme.color("foreground"), background: theme.color("background")
17 )
18 }
19}
20
621/// The buffer and the file on disk changed differently: what differs, and how to settle it.
722struct ConflictSheet: View {
823 let session: DocumentSession
@@ -15,7 +30,7 @@ struct ConflictSheet: View {
1530 .foregroundStyle(.secondary)
1631 .fixedSize(horizontal: false, vertical: true)
1732 if let versions = session.conflictVersions() {
18 DiffView(old: versions.disk, new: versions.mine)
33 ThemedDiff(old: versions.disk, new: versions.mine)
1934 }
2035 HStack {
2136 Button("Decide Later") { dismiss() }.keyboardShortcut(.cancelAction)
@@ -51,7 +66,7 @@ struct SyncConflictSheet: View {
5166 Text("Lines marked - are in the file, + in the copy. The copy goes to the recovery folder when it's resolved.")
5267 .foregroundStyle(.secondary)
5368 if let selected, let copy = session.recoveryText(selected), let mine = session.document?.text {
54 DiffView(old: mine, new: copy)
69 ThemedDiff(old: mine, new: copy)
5570 }
5671 }
5772 HStack {
@@ -102,7 +117,7 @@ struct RecoverySheet: View {
102117 VStack(alignment: .leading, spacing: 10) {
103118 Text("Lines marked - are in the buffer, + in the kept version.").foregroundStyle(.secondary)
104119 if let selected, let kept = session.recoveryText(selected), let mine = session.document?.text {
105 DiffView(old: mine, new: kept)
120 ThemedDiff(old: mine, new: kept)
106121 } else {
107122 Spacer()
108123 }
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. 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. Choose:
251251
252252| Button | What it does |
253253|--------------------+------------------------------------------------------------------------------------------------------------------|
docs/manual/guide/07-agenda.org +1 −1 · view
@@ -702,7 +702,7 @@ Columns: TODO, priority, title, tags, scheduled, deadline, your property columns
702702
703703** Kanban
704704
705Each TODO keyword your files use gets a column, in sequence order, done keywords included. A card shows the priority and title, the category and tags, and the deadline (in red) or the scheduled date. Drag a card to another column to set that keyword; this is the same edit as changing the state in the editor, so logging and state-change notes apply (a note is asked for in the main window). Double-click a card to open its entry. With VoiceOver, each card has a Move to … action for each other column.
705Each TODO keyword your files use gets a column, in sequence order, done keywords included. Column headings take the keyword colours of the agenda and editor (see [[file:13-configuration.org][Configuration]]). A card shows the priority and title, the category and tags, and the deadline or the scheduled date, in the theme's agenda colours: a past deadline in =agenda-overdue=, one due today or later in =agenda-due-soon=. Drag a card to another column to set that keyword; this is the same edit as changing the state in the editor, so logging and state-change notes apply (a note is asked for in the main window). Double-click a card to open its entry. With VoiceOver, each card has a Move to … action for each other column.
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
docs/manual/guide/13-configuration.org +7 −7 · view
@@ -752,17 +752,17 @@ The colors stack in this order, each over the one before: the themes chosen with
752752
753753| Key | Colors |
754754|-------------------------+--------------------------------------------------------------|
755| =background= | the editor's background |
756| =foreground= | body text |
755| =background= | the editor's background; on the Mac, comparisons of versions |
756| =foreground= | body text; on the Mac, board cards and comparisons |
757757| =cursor= | the caret |
758758| =selection= | selected text's background |
759759| =accent= | buttons, toggles and selection in lists; unset: the system's |
760760| =heading-1= … =heading-7= | headings of that level |
761761| =heading-8= | level 8 and deeper headings |
762| =todo= | TODO keywords not yet done |
762| =todo= | TODO keywords not yet done; on the Mac, removed lines in comparisons |
763763| =todo-next= | keywords of work under way: =NEXT=, =STRT= and the others above |
764764| =todo-waiting= | keywords of work on hold: =WAIT=, =HOLD= and the others above |
765| =done= | DONE keywords |
765| =done= | DONE keywords; on the Mac, added lines in comparisons |
766766| =todo-cancelled= | done keywords that cancel: =KILL=, =CANCELLED= and the others above |
767767| =priority= | =[#A]= cookies; in the agenda, priorities other than A, B and C |
768768| =priority-a= | agenda: priority A |
@@ -779,7 +779,7 @@ The colors stack in this order, each over the one before: the themes chosen with
779779| =keyword= | =#+KEYWORD= lines |
780780| =metadata= | planning lines, drawers, properties and clocks |
781781| =special= | footnotes, statistics cookies, targets, macros and LaTeX |
782| =block-background= | the band behind blocks |
782| =block-background= | the band behind blocks; board cards |
783783| =block-delimiter= | =#+begin_= and =#+end_= lines |
784784| =table= | tables |
785785| =line-number= | line numbers |
@@ -807,8 +807,8 @@ The colors stack in this order, each over the one before: the themes chosen with
807807| =agenda-today= | today's header and the now line |
808808| =agenda-time= | times and statuses of agenda rows with the normal status |
809809| =agenda-category= | categories |
810| =agenda-overdue= | agenda: the status of entries past their deadline or scheduled date, and the Overdue group |
811| =agenda-due-soon= | agenda: the status of deadlines due today or coming up |
810| =agenda-overdue= | agenda: the status of entries past their deadline or scheduled date, and the Overdue group; past deadlines on board cards |
811| =agenda-due-soon= | agenda: the status of deadlines due today or coming up; other deadlines on board cards |
812812| =agenda-event= | agenda: calendar events whose calendar has no color |
813813| =habit-clear= | habit graph: not due yet |
814814| =habit-ready= | habit graph: due |
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