Design review: themes, widgets, watch and Quick Look !468
16 files changed, +481 −89
Layout: unified · split
Sources/OrgPresentation/Palettes.swift +48 −42
| @@ -8,6 +8,8 @@ public struct Palette: Sendable, Equatable { | ||
| 8 | 8 | public let name: String |
| 9 | 9 | public let appearance: Appearance |
| 10 | 10 | public let colors: [String: RGBA] |
| 11 | /// Body text or coloured roles under 4.5:1 on the background, kept as upstream draws them. | |
| 12 | public let lowContrast: Bool | |
| 11 | 13 | |
| 12 | 14 | /// `name` in the user's language: Default and Paper are translated, the others are names. |
| 13 | 15 | public var displayName: String { |
| @@ -18,11 +20,12 @@ public struct Palette: Sendable, Equatable { | ||
| 18 | 20 | } |
| 19 | 21 | } |
| 20 | 22 | |
| 21 | public init(id: String, name: String, appearance: Appearance, colors: [String: RGBA]) { | |
| 23 | public init(id: String, name: String, appearance: Appearance, colors: [String: RGBA], lowContrast: Bool = false) { | |
| 22 | 24 | self.id = id |
| 23 | 25 | self.name = name |
| 24 | 26 | self.appearance = appearance |
| 25 | 27 | self.colors = colors |
| 28 | self.lowContrast = lowContrast | |
| 26 | 29 | } |
| 27 | 30 | } |
| 28 | 31 | |
| @@ -67,81 +70,84 @@ extension ThemeSpec { | ||
| 67 | 70 | |
| 68 | 71 | // Upstream palettes; see THIRD_PARTY.org. Colors darkened from upstream to read at 3:1 on |
| 69 | 72 | // the background: Solarized Light yellow, green and cyan; Catppuccin Latte orange, yellow |
| 70 | // and green; Tomorrow orange and yellow. | |
| 73 | // and green; Tomorrow orange and yellow. `secondary` is `dim` mixed toward `fg` until it | |
| 74 | // reads at 4.5:1 on the background. | |
| 71 | 75 | static let lightPalettes: [Palette] = [ |
| 72 | 76 | Palette(id: "default-light", name: "Default", appearance: .light, colors: ThemeSpec.default.light), |
| 73 | ported("solarized-light", "Solarized Light", .light, Roles( | |
| 74 | bg: "#fdf6e3", alt: "#eee8d5", fg: "#586e75", dim: "#93a1a1", red: "#dc322f", orange: "#cb4b16", yellow: "#a57c00", | |
| 75 | green: "#738a05", cyan: "#258f86", blue: "#268bd2", purple: "#6c71c4", accent: "#268bd2")), | |
| 77 | ported("solarized-light", "Solarized Light", .light, lowContrast: true, Roles( | |
| 78 | bg: "#fdf6e3", alt: "#eee8d5", fg: "#586e75", dim: "#93a1a1", secondary: "#5f747a", red: "#dc322f", orange: "#cb4b16", | |
| 79 | yellow: "#a57c00", green: "#738a05", cyan: "#258f86", blue: "#268bd2", purple: "#6c71c4", accent: "#268bd2")), | |
| 76 | 80 | ported("gruvbox-light", "Gruvbox Light", .light, Roles( |
| 77 | bg: "#fbf1c7", alt: "#ebdbb2", fg: "#3c3836", dim: "#928374", red: "#9d0006", orange: "#af3a03", yellow: "#b57614", | |
| 78 | green: "#79740e", cyan: "#427b58", blue: "#076678", purple: "#8f3f71", accent: "#076678")), | |
| 81 | bg: "#fbf1c7", alt: "#ebdbb2", fg: "#3c3836", dim: "#928374", secondary: "#776c61", red: "#9d0006", orange: "#af3a03", | |
| 82 | yellow: "#b57614", green: "#79740e", cyan: "#427b58", blue: "#076678", purple: "#8f3f71", accent: "#076678")), | |
| 79 | 83 | ported("modus-operandi", "Modus Operandi", .light, Roles( |
| 80 | bg: "#ffffff", alt: "#f2f2f2", fg: "#000000", dim: "#595959", red: "#a60000", orange: "#972500", yellow: "#6f5500", | |
| 81 | green: "#006800", cyan: "#005e8b", blue: "#0031a9", purple: "#721045", accent: "#0031a9")), | |
| 84 | bg: "#ffffff", alt: "#f2f2f2", fg: "#000000", dim: "#595959", secondary: "#595959", red: "#a60000", orange: "#972500", | |
| 85 | yellow: "#6f5500", green: "#006800", cyan: "#005e8b", blue: "#0031a9", purple: "#721045", accent: "#0031a9")), | |
| 82 | 86 | ported("catppuccin-latte", "Catppuccin Latte", .light, Roles( |
| 83 | bg: "#eff1f5", alt: "#e6e9ef", fg: "#4c4f69", dim: "#8c8fa1", red: "#d20f39", orange: "#d0590a", yellow: "#b06f13", | |
| 84 | green: "#388c24", cyan: "#179299", blue: "#1e66f5", purple: "#8839ef", accent: "#8839ef")), | |
| 87 | bg: "#eff1f5", alt: "#e6e9ef", fg: "#4c4f69", dim: "#8c8fa1", secondary: "#696c83", red: "#d20f39", orange: "#d0590a", | |
| 88 | yellow: "#b06f13", green: "#388c24", cyan: "#179299", blue: "#1e66f5", purple: "#8839ef", accent: "#8839ef")), | |
| 85 | 89 | ported("tomorrow", "Tomorrow", .light, Roles( |
| 86 | bg: "#ffffff", alt: "#efefef", fg: "#4d4d4c", dim: "#8e908c", red: "#c82829", orange: "#c76b17", yellow: "#a87e00", | |
| 87 | green: "#718c00", cyan: "#3e999f", blue: "#4271ae", purple: "#8959a8", accent: "#4271ae")), | |
| 90 | bg: "#ffffff", alt: "#efefef", fg: "#4d4d4c", dim: "#8e908c", secondary: "#767774", red: "#c82829", orange: "#c76b17", | |
| 91 | yellow: "#a87e00", green: "#718c00", cyan: "#3e999f", blue: "#4271ae", purple: "#8959a8", accent: "#4271ae")), | |
| 88 | 92 | // orgstar's own: warm paper and ink, for long reading. |
| 89 | 93 | ported("paper", "Paper", .light, Roles( |
| 90 | bg: "#f8f3e6", alt: "#efe8d6", fg: "#3b3428", dim: "#7d7262", red: "#a8322d", orange: "#a85a1f", yellow: "#8a6d1a", | |
| 91 | green: "#4d6b2f", cyan: "#2f6b6b", blue: "#2f5486", purple: "#6b4a85", accent: "#a85a1f")), | |
| 94 | bg: "#f8f3e6", alt: "#efe8d6", fg: "#3b3428", dim: "#7d7262", secondary: "#796e5f", red: "#a8322d", orange: "#a85a1f", | |
| 95 | yellow: "#8a6d1a", green: "#4d6b2f", cyan: "#2f6b6b", blue: "#2f5486", purple: "#6b4a85", accent: "#a85a1f")), | |
| 92 | 96 | ] |
| 93 | 97 | |
| 94 | 98 | static let darkPalettes: [Palette] = [ |
| 95 | 99 | Palette(id: "default-dark", name: "Default", appearance: .dark, colors: ThemeSpec.default.dark), |
| 96 | ported("solarized-dark", "Solarized Dark", .dark, Roles( | |
| 97 | bg: "#002b36", alt: "#073642", fg: "#93a1a1", dim: "#586e75", red: "#dc322f", orange: "#cb4b16", yellow: "#b58900", | |
| 98 | green: "#859900", cyan: "#2aa198", blue: "#268bd2", purple: "#6c71c4", accent: "#268bd2")), | |
| 100 | ported("solarized-dark", "Solarized Dark", .dark, lowContrast: true, Roles( | |
| 101 | bg: "#002b36", alt: "#073642", fg: "#93a1a1", dim: "#586e75", secondary: "#7f9092", red: "#dc322f", orange: "#cb4b16", | |
| 102 | yellow: "#b58900", green: "#859900", cyan: "#2aa198", blue: "#268bd2", purple: "#6c71c4", accent: "#268bd2")), | |
| 99 | 103 | ported("gruvbox-dark", "Gruvbox Dark", .dark, Roles( |
| 100 | bg: "#282828", alt: "#3c3836", fg: "#ebdbb2", dim: "#928374", red: "#fb4934", orange: "#fe8019", yellow: "#fabd2f", | |
| 101 | green: "#b8bb26", cyan: "#8ec07c", blue: "#83a598", purple: "#d3869b", accent: "#83a598")), | |
| 104 | bg: "#282828", alt: "#3c3836", fg: "#ebdbb2", dim: "#928374", secondary: "#9b8c7a", red: "#fb4934", orange: "#fe8019", | |
| 105 | yellow: "#fabd2f", green: "#b8bb26", cyan: "#8ec07c", blue: "#83a598", purple: "#d3869b", accent: "#83a598")), | |
| 102 | 106 | ported("modus-vivendi", "Modus Vivendi", .dark, Roles( |
| 103 | bg: "#000000", alt: "#1e1e1e", fg: "#ffffff", dim: "#989898", red: "#ff5f59", orange: "#fec43f", yellow: "#d0bc00", | |
| 104 | green: "#44bc44", cyan: "#00d3d0", blue: "#2fafff", purple: "#b6a0ff", accent: "#2fafff")), | |
| 107 | bg: "#000000", alt: "#1e1e1e", fg: "#ffffff", dim: "#989898", secondary: "#989898", red: "#ff5f59", orange: "#fec43f", | |
| 108 | yellow: "#d0bc00", green: "#44bc44", cyan: "#00d3d0", blue: "#2fafff", purple: "#b6a0ff", accent: "#2fafff")), | |
| 105 | 109 | ported("catppuccin-mocha", "Catppuccin Mocha", .dark, Roles( |
| 106 | bg: "#1e1e2e", alt: "#181825", fg: "#cdd6f4", dim: "#7f849c", red: "#f38ba8", orange: "#fab387", yellow: "#f9e2af", | |
| 107 | green: "#a6e3a1", cyan: "#94e2d5", blue: "#89b4fa", purple: "#cba6f7", accent: "#cba6f7")), | |
| 110 | bg: "#1e1e2e", alt: "#181825", fg: "#cdd6f4", dim: "#7f849c", secondary: "#81869e", red: "#f38ba8", orange: "#fab387", | |
| 111 | yellow: "#f9e2af", green: "#a6e3a1", cyan: "#94e2d5", blue: "#89b4fa", purple: "#cba6f7", accent: "#cba6f7")), | |
| 108 | 112 | ported("nord", "Nord", .dark, Roles( |
| 109 | bg: "#2e3440", alt: "#3b4252", fg: "#d8dee9", dim: "#616e88", red: "#bf616a", orange: "#d08770", yellow: "#ebcb8b", | |
| 110 | green: "#a3be8c", cyan: "#8fbcbb", blue: "#88c0d0", purple: "#b48ead", accent: "#88c0d0")), | |
| 113 | bg: "#2e3440", alt: "#3b4252", fg: "#d8dee9", dim: "#616e88", secondary: "#929cb0", red: "#bf616a", orange: "#d08770", | |
| 114 | yellow: "#ebcb8b", green: "#a3be8c", cyan: "#8fbcbb", blue: "#88c0d0", purple: "#b48ead", accent: "#88c0d0")), | |
| 111 | 115 | ported("dracula", "Dracula", .dark, Roles( |
| 112 | bg: "#282a36", alt: "#44475a", fg: "#f8f8f2", dim: "#6272a4", red: "#ff5555", orange: "#ffb86c", yellow: "#f1fa8c", | |
| 113 | green: "#50fa7b", cyan: "#8be9fd", blue: "#8be9fd", purple: "#bd93f9", accent: "#bd93f9")), | |
| 116 | bg: "#282a36", alt: "#44475a", fg: "#f8f8f2", dim: "#6272a4", secondary: "#8491b6", red: "#ff5555", orange: "#ffb86c", | |
| 117 | yellow: "#f1fa8c", green: "#50fa7b", cyan: "#8be9fd", blue: "#8be9fd", purple: "#bd93f9", accent: "#bd93f9")), | |
| 114 | 118 | ported("tokyo-night", "Tokyo Night", .dark, Roles( |
| 115 | bg: "#1a1b26", alt: "#16161e", fg: "#c0caf5", dim: "#565f89", red: "#f7768e", orange: "#ff9e64", yellow: "#e0af68", | |
| 116 | green: "#9ece6a", cyan: "#7dcfff", blue: "#7aa2f7", purple: "#bb9af7", accent: "#7aa2f7")), | |
| 119 | bg: "#1a1b26", alt: "#16161e", fg: "#c0caf5", dim: "#565f89", secondary: "#7881ac", red: "#f7768e", orange: "#ff9e64", | |
| 120 | yellow: "#e0af68", green: "#9ece6a", cyan: "#7dcfff", blue: "#7aa2f7", purple: "#bb9af7", accent: "#7aa2f7")), | |
| 117 | 121 | ported("doom-one", "doom-one", .dark, Roles( |
| 118 | bg: "#282c34", alt: "#21242b", fg: "#bbc2cf", dim: "#5b6268", red: "#ff6c6b", orange: "#da8548", yellow: "#ecbe7b", | |
| 119 | green: "#98be65", cyan: "#46d9ff", blue: "#51afef", purple: "#c678dd", accent: "#51afef")), | |
| 122 | bg: "#282c34", alt: "#21242b", fg: "#bbc2cf", dim: "#5b6268", secondary: "#8c939d", red: "#ff6c6b", orange: "#da8548", | |
| 123 | yellow: "#ecbe7b", green: "#98be65", cyan: "#46d9ff", blue: "#51afef", purple: "#c678dd", accent: "#51afef")), | |
| 120 | 124 | ] |
| 121 | 125 | } |
| 122 | 126 | |
| 123 | 127 | extension ThemeSpec { |
| 124 | 128 | /// A palette's named colors, from which every slot is set. |
| 125 | 129 | public struct Roles: Sendable { |
| 126 | public var bg, alt, fg, dim, red, orange, yellow, green, cyan, blue, purple, accent: String | |
| 130 | /// `dim` is for marks that aren't read as text (markup, delimiters, line numbers); | |
| 131 | /// `secondary` for quieter text (tags, comments, planning lines, agenda times). | |
| 132 | public var bg, alt, fg, dim, secondary, red, orange, yellow, green, cyan, blue, purple, accent: String | |
| 127 | 133 | |
| 128 | 134 | /// Slot → role. `selection` and `inline-background` are translucent roles. |
| 129 | 135 | static let slots: [String: KeyPath<Roles, String> & Sendable] = [ |
| 130 | 136 | "background": \.bg, "foreground": \.fg, "cursor": \.accent, "accent": \.accent, |
| 131 | 137 | "heading-1": \.blue, "heading-2": \.purple, "heading-3": \.green, "heading-4": \.orange, |
| 132 | 138 | "heading-5": \.blue, "heading-6": \.purple, "heading-7": \.green, "heading-8": \.orange, |
| 133 | "todo": \.red, "todo-next": \.blue, "todo-waiting": \.yellow, "done": \.green, "todo-cancelled": \.dim, | |
| 134 | "priority": \.orange, "priority-a": \.red, "priority-b": \.orange, "priority-c": \.dim, | |
| 135 | "tags": \.dim, "link": \.blue, "timestamp": \.purple, "code": \.orange, "verbatim": \.cyan, | |
| 136 | "markup": \.dim, "comment": \.dim, "keyword": \.dim, "metadata": \.dim, "special": \.cyan, | |
| 139 | "todo": \.red, "todo-next": \.blue, "todo-waiting": \.yellow, "done": \.green, "todo-cancelled": \.secondary, | |
| 140 | "priority": \.orange, "priority-a": \.red, "priority-b": \.orange, "priority-c": \.secondary, | |
| 141 | "tags": \.secondary, "link": \.blue, "timestamp": \.purple, "code": \.orange, "verbatim": \.cyan, | |
| 142 | "markup": \.dim, "comment": \.secondary, "keyword": \.secondary, "metadata": \.secondary, "special": \.cyan, | |
| 137 | 143 | "block-background": \.alt, "block-delimiter": \.dim, "table": \.fg, |
| 138 | 144 | "line-number": \.dim, "line-number-current": \.fg, |
| 139 | "syntax-keyword": \.purple, "syntax-string": \.green, "syntax-comment": \.dim, "syntax-function": \.blue, | |
| 145 | "syntax-keyword": \.purple, "syntax-string": \.green, "syntax-comment": \.secondary, "syntax-function": \.blue, | |
| 140 | 146 | "syntax-type": \.yellow, "syntax-number": \.orange, "syntax-property": \.cyan, "syntax-label": \.purple, |
| 141 | "sidebar-background": \.alt, "sidebar-foreground": \.fg, "sidebar-header": \.dim, | |
| 147 | "sidebar-background": \.alt, "sidebar-foreground": \.fg, "sidebar-header": \.secondary, | |
| 142 | 148 | "modeline-background": \.alt, "modeline-foreground": \.fg, "modeline-highlight": \.accent, |
| 143 | 149 | "state-normal": \.blue, "state-insert": \.green, "state-visual": \.orange, |
| 144 | "agenda-background": \.bg, "agenda-date": \.fg, "agenda-today": \.accent, "agenda-time": \.dim, "agenda-category": \.dim, | |
| 150 | "agenda-background": \.bg, "agenda-date": \.fg, "agenda-today": \.accent, "agenda-time": \.secondary, "agenda-category": \.secondary, | |
| 145 | 151 | "agenda-overdue": \.red, "agenda-due-soon": \.orange, "agenda-event": \.purple, |
| 146 | 152 | "habit-clear": \.blue, "habit-ready": \.green, "habit-alert": \.yellow, "habit-overdue": \.red, |
| 147 | 153 | ] |
| @@ -162,8 +168,8 @@ extension ThemeSpec { | ||
| 162 | 168 | } |
| 163 | 169 | } |
| 164 | 170 | |
| 165 | private static func ported(_ id: String, _ name: String, _ appearance: Palette.Appearance, _ roles: Roles) -> Palette { | |
| 166 | Palette(id: id, name: name, appearance: appearance, colors: roles.colors(dark: appearance == .dark)) | |
| 171 | private static func ported(_ id: String, _ name: String, _ appearance: Palette.Appearance, lowContrast: Bool = false, _ roles: Roles) -> Palette { | |
| 172 | Palette(id: id, name: name, appearance: appearance, colors: roles.colors(dark: appearance == .dark), lowContrast: lowContrast) | |
| 167 | 173 | } |
| 168 | 174 | } |
| 169 | 175 | |
Sources/OrgPresentation/ThemeSpec.swift +7 −7
| @@ -153,17 +153,17 @@ public struct ThemeSpec: Equatable, Sendable { | ||
| 153 | 153 | "background": "#ffffff", "foreground": "#1f2328", "cursor": "#0969da", "selection": "#0969da33", |
| 154 | 154 | "heading-1": "#0550ae", "heading-2": "#8250df", "heading-3": "#116329", "heading-4": "#953800", |
| 155 | 155 | "heading-5": "#0550ae", "heading-6": "#8250df", "heading-7": "#116329", "heading-8": "#953800", |
| 156 | "todo": "#d70015", "done": "#248a3d", "priority": "#c93400", "tags": "#6e7781", | |
| 157 | "todo-next": "#0a66d8", "todo-waiting": "#b25000", "todo-cancelled": "#8e8e93", | |
| 158 | "priority-a": "#d70015", "priority-b": "#c93400", "priority-c": "#6c7a8c", | |
| 156 | "todo": "#d70015", "done": "#1a7f37", "priority": "#c93400", "tags": "#6e7781", | |
| 157 | "todo-next": "#0a66d8", "todo-waiting": "#b25000", "todo-cancelled": "#6e7781", | |
| 158 | "priority-a": "#d70015", "priority-b": "#c93400", "priority-c": "#6a788a", | |
| 159 | 159 | "link": "#0969da", "timestamp": "#8250df", "code": "#953800", "verbatim": "#0a3069", "inline-background": "#afb8c133", |
| 160 | "markup": "#8c959f", "comment": "#6e7781", "keyword": "#6e7781", "metadata": "#6e7781", "special": "#1b7c83", | |
| 161 | "block-background": "#f6f8fa", "block-delimiter": "#8c959f", "table": "#1f2328", | |
| 162 | "line-number": "#8c959f", "line-number-current": "#1f2328", | |
| 160 | "markup": "#6e7781", "comment": "#6e7781", "keyword": "#6e7781", "metadata": "#6e7781", "special": "#1b7c83", | |
| 161 | "block-background": "#f6f8fa", "block-delimiter": "#6e7781", "table": "#1f2328", | |
| 162 | "line-number": "#6e7781", "line-number-current": "#1f2328", | |
| 163 | 163 | "syntax-keyword": "#cf222e", "syntax-string": "#0a3069", "syntax-comment": "#6e7781", "syntax-function": "#8250df", |
| 164 | 164 | "syntax-type": "#953800", "syntax-number": "#1b7c83", "syntax-property": "#0550ae", "syntax-label": "#8250df", |
| 165 | 165 | "modeline-highlight": "#1f2328", "state-normal": "#0969da", "state-insert": "#1a7f37", "state-visual": "#bc4c00", |
| 166 | "agenda-date": "#1f2328", "agenda-today": "#007aff", "agenda-time": "#6c6c70", "agenda-category": "#6c6c70", | |
| 166 | "agenda-date": "#1f2328", "agenda-today": "#0969da", "agenda-time": "#6c6c70", "agenda-category": "#6c6c70", | |
| 167 | 167 | "agenda-overdue": "#d70015", "agenda-due-soon": "#c93400", "agenda-event": "#8944ab", |
| 168 | 168 | "habit-clear": "#54aeff", "habit-ready": "#4ac26b", "habit-alert": "#d4a72c", "habit-overdue": "#ff8182", |
| 169 | 169 | ]), |
Sources/OrgstarQuickLook/PreviewProvider.swift +3 −1
| @@ -10,7 +10,9 @@ import QuickLook | ||
| 10 | 10 | @objc(PreviewProvider) |
| 11 | 11 | final class PreviewProvider: QLPreviewProvider, QLPreviewingController { |
| 12 | 12 | func providePreview(for request: QLFilePreviewRequest) async throws -> QLPreviewReply { |
| 13 | let text = try String(contentsOf: request.fileURL, encoding: .utf8) | |
| 13 | // Latin-1 maps every byte, so a file that isn't UTF-8 still shows. | |
| 14 | let data = try Data(contentsOf: request.fileURL) | |
| 15 | let text = String(data: data, encoding: .utf8) ?? String(data: data, encoding: .isoLatin1) ?? "" | |
| 14 | 16 | let title = request.fileURL.deletingPathExtension().lastPathComponent |
| 15 | 17 | let html = HTMLExport.page(text, fallbackTitle: title, settings: OrgSettings.default.resolvingSetupFiles(in: text, path: request.fileURL.path, read: OrgSettings.readFile), path: request.fileURL.path) |
| 16 | 18 | return QLPreviewReply(dataOfContentType: .html, contentSize: CGSize(width: 800, height: 800)) { _ in Data(html.utf8) } |
Sources/OrgstarWatch/WatchApp.swift +32 −4
| @@ -103,6 +103,12 @@ struct AgendaList: View { | ||
| 103 | 103 | .foregroundStyle(.secondary) |
| 104 | 104 | } |
| 105 | 105 | .navigationTitle("Today") |
| 106 | } else if link.agenda == nil { | |
| 107 | ScrollView { | |
| 108 | Text("Open orgstar on your iPhone to show your agenda here.") | |
| 109 | .foregroundStyle(.secondary) | |
| 110 | } | |
| 111 | .navigationTitle("Today") | |
| 106 | 112 | } else { |
| 107 | 113 | list |
| 108 | 114 | } |
| @@ -147,8 +153,6 @@ struct AgendaList: View { | ||
| 147 | 153 | if agenda.rows.isEmpty { Text("Nothing scheduled").foregroundStyle(.secondary) } |
| 148 | 154 | ForEach(agenda.rows) { EntryRow(entry: $0, link: link) } |
| 149 | 155 | } |
| 150 | } else { | |
| 151 | Text("Open orgstar on your iPhone to show your agenda here.").foregroundStyle(.secondary) | |
| 152 | 156 | } |
| 153 | 157 | } |
| 154 | 158 | .navigationTitle("Today") |
| @@ -175,13 +179,37 @@ struct EntryRow: View { | ||
| 175 | 179 | } |
| 176 | 180 | VStack(alignment: .leading, spacing: 1) { |
| 177 | 181 | if !entry.gutter.isEmpty { |
| 178 | Text(entry.gutter).font(.caption2).foregroundStyle(entry.status == "overdue" ? .red : .secondary) | |
| 182 | Text(entry.gutter).font(.caption2).foregroundStyle(statusColor) | |
| 179 | 183 | } |
| 180 | 184 | Text(entry.title).strikethrough(entry.isDone).lineLimit(3) |
| 181 | if let todo = entry.todo { Text(todo).font(.caption2.weight(.semibold)).foregroundStyle(entry.isDone ? .green : .orange) } | |
| 185 | if let todo = entry.todo { Text(todo).font(.caption2.weight(.semibold)).foregroundStyle(Self.color(keyword: todo, isDone: entry.isDone)) } | |
| 182 | 186 | } |
| 183 | 187 | } |
| 184 | 188 | } |
| 189 | ||
| 190 | /// The agenda's status colors: `agenda-overdue`, `agenda-due-soon`, `done`. | |
| 191 | private var statusColor: Color { | |
| 192 | switch entry.status { | |
| 193 | case "overdue": .red | |
| 194 | case "due-soon": .orange | |
| 195 | case "done": .green | |
| 196 | default: .secondary | |
| 197 | } | |
| 198 | } | |
| 199 | ||
| 200 | /// The keyword's class color, as the default theme draws it: `todo`, `todo-next`, | |
| 201 | /// `todo-waiting`, `done`, `todo-cancelled`. The words are `ThemeSpec.TodoClass`'s. | |
| 202 | static func color(keyword: String, isDone: Bool) -> Color { | |
| 203 | let word = keyword.uppercased() | |
| 204 | if isDone { return cancelledWords.contains(word) ? .gray : .green } | |
| 205 | if nextWords.contains(word) { return .blue } | |
| 206 | if waitingWords.contains(word) { return .yellow } | |
| 207 | return .red | |
| 208 | } | |
| 209 | ||
| 210 | static let nextWords: Set<String> = ["NEXT", "STRT", "STARTED", "START", "DOING", "ACTIVE", "INPROGRESS", "IN-PROGRESS"] | |
| 211 | static let waitingWords: Set<String> = ["WAIT", "WAITING", "HOLD", "ONHOLD", "BLOCKED", "DEFERRED", "SOMEDAY", "MAYBE"] | |
| 212 | static let cancelledWords: Set<String> = ["KILL", "KILLED", "CANCELLED", "CANCELED", "CANCEL", "SKIPPED", "SKIP", "ABORTED", "NO", "WONTFIX"] | |
| 185 | 213 | } |
| 186 | 214 | #else |
| 187 | 215 | /// The watch app builds for watchOS only; elsewhere the product does nothing. |
Sources/OrgstarWatchWidgets/WatchWidgets.swift +11 −4
| @@ -59,7 +59,7 @@ struct NextEntryView: View { | ||
| 59 | 59 | var body: some View { |
| 60 | 60 | switch family { |
| 61 | 61 | case .accessoryInline: |
| 62 | Text(next.map { "\($0.gutter) \($0.title)" } ?? (open == 0 ? "Agenda clear" : "\(open) open today")) | |
| 62 | Text(next.map { "\($0.gutter) \($0.title)" } ?? (open == 0 ? String(localized: "Agenda clear") : String(localized: "\(open) open today"))) | |
| 63 | 63 | case .accessoryCircular: |
| 64 | 64 | ZStack { |
| 65 | 65 | AccessoryWidgetBackground() |
| @@ -68,14 +68,18 @@ struct NextEntryView: View { | ||
| 68 | 68 | Text("open").font(.caption2) |
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | .accessibilityElement(children: .ignore) | |
| 72 | .accessibilityLabel(Text("\(open) open today")) | |
| 71 | 73 | case .accessoryCorner: |
| 72 | Text("\(open)").font(.title3.weight(.semibold)).widgetLabel { Text(next?.title ?? "Agenda clear") } | |
| 74 | Text("\(open)").font(.title3.weight(.semibold)).widgetLabel { Text(next?.title ?? String(localized: "Agenda clear")) } | |
| 75 | .accessibilityLabel(Text("\(open) open today") + Text(verbatim: next.map { ", \($0.title)" } ?? "")) | |
| 73 | 76 | default: |
| 74 | 77 | VStack(alignment: .leading, spacing: 0) { |
| 75 | Text(next?.gutter ?? "Agenda").font(.headline).widgetAccentable().lineLimit(1) | |
| 76 | Text(next?.title ?? (entry.agenda == nil ? "Open orgstar" : "Nothing left today")).lineLimit(2) | |
| 78 | Text(next?.gutter ?? String(localized: "Agenda")).font(.headline).widgetAccentable().lineLimit(1) | |
| 79 | Text(next?.title ?? (entry.agenda == nil ? String(localized: "Open orgstar") : String(localized: "Nothing left today"))).lineLimit(2) | |
| 77 | 80 | } |
| 78 | 81 | .frame(maxWidth: .infinity, alignment: .leading) |
| 82 | .accessibilityElement(children: .combine) | |
| 79 | 83 | } |
| 80 | 84 | } |
| 81 | 85 | } |
| @@ -109,6 +113,8 @@ struct ClockView: View { | ||
| 109 | 113 | Image(systemName: "stopwatch").font(.title3) |
| 110 | 114 | } |
| 111 | 115 | } |
| 116 | .accessibilityElement(children: .ignore) | |
| 117 | .accessibilityLabel(clock.map { Text("Clocked in") + Text(verbatim: ", \($0.heading), ") + Text($0.startedAt, style: .timer) } ?? Text("Not clocked in")) | |
| 112 | 118 | default: |
| 113 | 119 | VStack(alignment: .leading, spacing: 0) { |
| 114 | 120 | if let clock { |
| @@ -120,6 +126,7 @@ struct ClockView: View { | ||
| 120 | 126 | } |
| 121 | 127 | } |
| 122 | 128 | .frame(maxWidth: .infinity, alignment: .leading) |
| 129 | .accessibilityElement(children: .combine) | |
| 123 | 130 | } |
| 124 | 131 | } |
| 125 | 132 | } |
Sources/OrgstarWidgets/AgendaTimeline.swift +1 −1
| @@ -102,7 +102,7 @@ extension AgendaSnapshot { | ||
| 102 | 102 | ) |
| 103 | 103 | return AgendaSnapshot( |
| 104 | 104 | generated: now, days: [today, tomorrow], |
| 105 | colors: ["agenda-today": Hex(light: "#007aff", dark: "#0a84ff"), "agenda-time": gray, "foreground": Hex(light: "#1f2328", dark: "#e6edf3")] | |
| 105 | colors: ["agenda-today": Hex(light: "#0969da", dark: "#0a84ff"), "agenda-time": gray, "foreground": Hex(light: "#1f2328", dark: "#e6edf3")] | |
| 106 | 106 | ) |
| 107 | 107 | } |
| 108 | 108 | } |
Sources/OrgstarWidgets/ClockActivityWidget.swift +5 −1
| @@ -66,7 +66,11 @@ struct ElapsedText: View { | ||
| 66 | 66 | struct ClockOutButton: View { |
| 67 | 67 | var body: some View { |
| 68 | 68 | Button(intent: ClockOutIntent()) { |
| 69 | Label("Clock Out", systemImage: "stop.fill").font(.caption.weight(.semibold)) | |
| 69 | Label( | |
| 70 | String(localized: "clock-activity.clock-out", defaultValue: "Clock Out", comment: "Live Activity button that stops the running clock; keep it short"), | |
| 71 | systemImage: "stop.fill" | |
| 72 | ) | |
| 73 | .font(.caption.weight(.semibold)) | |
| 70 | 74 | } |
| 71 | 75 | .tint(.orange) |
| 72 | 76 | } |
Sources/OrgstarWidgets/Controls.swift +5 −4
| @@ -9,7 +9,7 @@ struct CaptureControl: ControlWidget { | ||
| 9 | 9 | var body: some ControlWidgetConfiguration { |
| 10 | 10 | AppIntentControlConfiguration(kind: "sh.krz.orgstar.capture-control", intent: CaptureControlConfiguration.self) { configuration in |
| 11 | 11 | ControlWidgetButton(action: OpenCaptureIntent(template: configuration.template)) { |
| 12 | Label(configuration.template?.name ?? "Capture", systemImage: "square.and.pencil") | |
| 12 | Label(configuration.template?.name ?? String(localized: "Capture"), systemImage: "square.and.pencil") | |
| 13 | 13 | } |
| 14 | 14 | } |
| 15 | 15 | .displayName("Capture") |
| @@ -23,7 +23,8 @@ struct ClockControl: ControlWidget { | ||
| 23 | 23 | var body: some ControlWidgetConfiguration { |
| 24 | 24 | StaticControlConfiguration(kind: "sh.krz.orgstar.clock-control", provider: ClockValueProvider()) { clock in |
| 25 | 25 | ControlWidgetToggle("Clock", isOn: clock.running != nil, action: ClockToggleIntent()) { isOn in |
| 26 | Label(isOn ? clock.running ?? "Clocked in" : clock.last.map { "In: \($0)" } ?? "No recent clock", | |
| 26 | Label(isOn ? clock.running ?? String(localized: "Clocked in") | |
| 27 | : clock.last.map { String(localized: "Clock In to \($0)") } ?? String(localized: "No recent clock"), | |
| 27 | 28 | systemImage: isOn ? "stopwatch.fill" : "stopwatch") |
| 28 | 29 | } |
| 29 | 30 | .tint(.orange) |
| @@ -88,7 +89,7 @@ struct CaptureView: View { | ||
| 88 | 89 | Image(systemName: "square.and.pencil").font(.title3) |
| 89 | 90 | VStack(alignment: .leading, spacing: 0) { |
| 90 | 91 | Text("Capture").font(.headline) |
| 91 | Text(entry.template?.name ?? "First template").font(.caption).foregroundStyle(.secondary).lineLimit(1) | |
| 92 | Text(entry.template?.name ?? String(localized: "First template")).font(.caption).foregroundStyle(.secondary).lineLimit(1) | |
| 92 | 93 | } |
| 93 | 94 | Spacer(minLength: 0) |
| 94 | 95 | } |
| @@ -96,7 +97,7 @@ struct CaptureView: View { | ||
| 96 | 97 | } |
| 97 | 98 | .widgetURL(AppLink.capture(template: entry.template?.id).url) |
| 98 | 99 | .containerBackground(for: .widget) { Color.clear } |
| 99 | .accessibilityLabel("Capture" + (entry.template.map { " with \($0.name)" } ?? "")) | |
| 100 | .accessibilityLabel(entry.template.map { Text("Capture with \($0.name)") } ?? Text("Capture")) | |
| 100 | 101 | } |
| 101 | 102 | } |
| 102 | 103 | #endif |
Sources/OrgstarWidgets/HabitsWidget.swift +71 −14
| @@ -72,7 +72,7 @@ struct HabitsView: View { | ||
| 72 | 72 | let done = snapshot.habits.filter { $0.habit.doneDates.contains(today) }.count |
| 73 | 73 | return VStack(alignment: .leading, spacing: family == .systemSmall ? 6 : 8) { |
| 74 | 74 | HStack(alignment: .firstTextBaseline) { |
| 75 | Text("Habits").font(.subheadline.weight(.semibold)) | |
| 75 | Text("Habits").font(.subheadline.weight(.semibold)).widgetAccentable() | |
| 76 | 76 | Spacer(minLength: 0) |
| 77 | 77 | Text("\(done)/\(snapshot.habits.count) today").font(.caption2.weight(.semibold)).foregroundStyle(.secondary) |
| 78 | 78 | } |
| @@ -91,43 +91,100 @@ struct HabitsView: View { | ||
| 91 | 91 | let cells = habit.habit.graph(today: today, preceding: 6, following: 1) |
| 92 | 92 | VStack(alignment: .leading, spacing: 2) { |
| 93 | 93 | Text(habit.title).font(.caption).lineLimit(1) |
| 94 | HabitCells(cells: cells, colors: snapshot.colors, width: 12, height: 8) | |
| 94 | HabitCells(cells: cells, today: today, colors: snapshot.colors, width: 12, height: 8) | |
| 95 | 95 | } |
| 96 | .accessibilityElement(children: .combine) | |
| 96 | 97 | } else { |
| 97 | 98 | HStack(spacing: 8) { |
| 98 | 99 | Text(habit.title).font(.caption).lineLimit(1) |
| 99 | 100 | Spacer(minLength: 4) |
| 100 | HabitCells(cells: habit.habit.graph(today: today), colors: snapshot.colors, width: 5, height: 12) | |
| 101 | HabitCells(cells: habit.habit.graph(today: today), today: today, colors: snapshot.colors, width: 5, height: 12) | |
| 101 | 102 | } |
| 103 | .accessibilityElement(children: .combine) | |
| 102 | 104 | } |
| 103 | 105 | } |
| 104 | 106 | } |
| 105 | 107 | |
| 106 | 108 | /// org-habit's graph: a bar per day in the due-state color, lighter for days to come, a dot |
| 107 | /// where it was done, today outlined. | |
| 109 | /// where it was done, today outlined. With Differentiate Without Colour, and in the tinted and | |
| 110 | /// clear styles, which draw every colour in one tint, the state is also how solid the bar is, | |
| 111 | /// from clear (faintest) to overdue (solid), and days to come are outlined. | |
| 108 | 112 | struct HabitCells: View { |
| 109 | 113 | let cells: [Habit.Cell] |
| 114 | let today: Int | |
| 110 | 115 | let colors: [String: AgendaSnapshot.Hex] |
| 111 | 116 | let width: CGFloat |
| 112 | 117 | let height: CGFloat |
| 113 | 118 | @Environment(\.colorScheme) private var scheme |
| 119 | @Environment(\.accessibilityDifferentiateWithoutColor) private var differentiateWithoutColor | |
| 120 | @Environment(\.widgetRenderingMode) private var renderingMode | |
| 121 | ||
| 122 | private var stepped: Bool { differentiateWithoutColor || renderingMode != .fullColor } | |
| 114 | 123 | |
| 115 | 124 | var body: some View { |
| 116 | 125 | HStack(spacing: 1) { |
| 117 | 126 | ForEach(cells, id: \.day) { cell in |
| 118 | RoundedRectangle(cornerRadius: 1.5) | |
| 119 | .fill(color(cell.face)) | |
| 120 | .frame(width: width, height: height) | |
| 121 | .overlay { | |
| 122 | if cell.glyph == "*" { Circle().fill(.white.opacity(0.9)).frame(width: min(width, height) * 0.6) } | |
| 123 | } | |
| 124 | .overlay { | |
| 125 | if cell.glyph == "!" { RoundedRectangle(cornerRadius: 1.5).strokeBorder(Color.primary, lineWidth: 1) } | |
| 126 | } | |
| 127 | if stepped { | |
| 128 | steppedCell(cell) | |
| 129 | } else { | |
| 130 | RoundedRectangle(cornerRadius: 1.5) | |
| 131 | .fill(color(cell.face)) | |
| 132 | .frame(width: width, height: height) | |
| 133 | .overlay { | |
| 134 | if cell.glyph == "*" { Circle().fill(.white.opacity(0.9)).frame(width: min(width, height) * 0.6) } | |
| 135 | } | |
| 136 | .overlay { | |
| 137 | if cell.glyph == "!" { RoundedRectangle(cornerRadius: 1.5).strokeBorder(Color.primary, lineWidth: 1) } | |
| 138 | } | |
| 139 | } | |
| 127 | 140 | } |
| 128 | 141 | } |
| 129 | 142 | .accessibilityElement(children: .ignore) |
| 130 | .accessibilityLabel("Done \(cells.filter { $0.glyph == "*" }.count) of \(cells.count) days") | |
| 143 | .accessibilityLabel(Text("Done \(cells.filter { $0.glyph == "*" }.count) of \(cells.count) days") + Text(verbatim: ", ") + todayState) | |
| 144 | } | |
| 145 | ||
| 146 | /// Today's state in words. | |
| 147 | private var todayState: Text { | |
| 148 | guard let cell = cells.first(where: { $0.day == today }) else { return Text(verbatim: "") } | |
| 149 | if cell.glyph == "*" { return Text("Done today") } | |
| 150 | switch cell.face { | |
| 151 | case .clear, .clearFuture: return Text("Not due today") | |
| 152 | case .ready, .readyFuture: return Text("Due today") | |
| 153 | case .alert, .alertFuture: return Text("Last chance today") | |
| 154 | case .overdue, .overdueFuture: return Text("Overdue") | |
| 155 | } | |
| 156 | } | |
| 157 | ||
| 158 | /// A filled bar for past days and an outline for days to come, at the state's step; a | |
| 159 | /// done day has a dot, cut out of the darker steps. | |
| 160 | private func steppedCell(_ cell: Habit.Cell) -> some View { | |
| 161 | let (key, fallback, step, future) = Self.state(cell.face) | |
| 162 | let color = (colors[key]?.color(scheme) ?? fallback).opacity(step) | |
| 163 | let shape = RoundedRectangle(cornerRadius: 1.5) | |
| 164 | let dot = Circle().frame(width: min(width, height) * 0.6) | |
| 165 | return ZStack { | |
| 166 | if future { shape.strokeBorder(color, lineWidth: 1) } else { shape.fill(color) } | |
| 167 | if cell.glyph == "*" { | |
| 168 | if step >= 0.75 { dot.blendMode(.destinationOut) } else { dot.foregroundStyle(Color.primary) } | |
| 169 | } | |
| 170 | if cell.glyph == "!" { shape.strokeBorder(Color.primary, lineWidth: 1) } | |
| 171 | } | |
| 172 | .compositingGroup() | |
| 173 | .frame(width: width, height: height) | |
| 174 | } | |
| 175 | ||
| 176 | /// The theme key, its fallback, the opacity step and whether the day is to come. | |
| 177 | private static func state(_ face: Habit.Face) -> (String, Color, Double, Bool) { | |
| 178 | switch face { | |
| 179 | case .clear: ("habit-clear", .blue, 0.25, false) | |
| 180 | case .clearFuture: ("habit-clear", .blue, 0.25, true) | |
| 181 | case .ready: ("habit-ready", .green, 0.5, false) | |
| 182 | case .readyFuture: ("habit-ready", .green, 0.5, true) | |
| 183 | case .alert: ("habit-alert", .yellow, 0.75, false) | |
| 184 | case .alertFuture: ("habit-alert", .yellow, 0.75, true) | |
| 185 | case .overdue: ("habit-overdue", .red, 1, false) | |
| 186 | case .overdueFuture: ("habit-overdue", .red, 1, true) | |
| 187 | } | |
| 131 | 188 | } |
| 132 | 189 | |
| 133 | 190 | private func color(_ face: Habit.Face) -> Color { |
Sources/OrgstarWidgets/TodayWidget.swift +23 −6
| @@ -72,6 +72,7 @@ struct TodayView: View { | ||
| 72 | 72 | Text(entry.date, format: family == .systemSmall ? .dateTime.weekday(.abbreviated).day() : .dateTime.weekday(.wide).day().month()) |
| 73 | 73 | .font(.subheadline.weight(.semibold)) |
| 74 | 74 | .foregroundStyle(snapshot.color("agenda-today", scheme) ?? .accentColor) |
| 75 | .widgetAccentable() | |
| 75 | 76 | Spacer(minLength: 0) |
| 76 | 77 | if overdue > 0, family != .systemSmall { |
| 77 | 78 | Text("\(overdue) overdue") |
| @@ -85,7 +86,7 @@ struct TodayView: View { | ||
| 85 | 86 | } |
| 86 | 87 | |
| 87 | 88 | @ViewBuilder |
| 88 | private func rows(_ rows: [AgendaSnapshot.Row], _ snapshot: AgendaSnapshot, compact: Bool, empty: String) -> some View { | |
| 89 | private func rows(_ rows: [AgendaSnapshot.Row], _ snapshot: AgendaSnapshot, compact: Bool, empty: LocalizedStringKey) -> some View { | |
| 89 | 90 | if rows.isEmpty { |
| 90 | 91 | Text(empty).font(.caption).foregroundStyle(.secondary) |
| 91 | 92 | } |
| @@ -113,6 +114,7 @@ struct SmallRow: View { | ||
| 113 | 114 | .foregroundStyle(row.statusColor?.color(scheme) ?? .secondary) |
| 114 | 115 | Text(row.title).font(.caption).lineLimit(1) |
| 115 | 116 | } |
| 117 | .accessibilityElement(children: .combine) | |
| 116 | 118 | } |
| 117 | 119 | } |
| 118 | 120 | |
| @@ -120,6 +122,9 @@ struct SmallRow: View { | ||
| 120 | 122 | struct WideRow: View { |
| 121 | 123 | let row: AgendaSnapshot.Row |
| 122 | 124 | @Environment(\.colorScheme) private var scheme |
| 125 | @ScaledMetric(relativeTo: .caption2) private var gutterWidth: CGFloat = 72 | |
| 126 | @ScaledMetric(relativeTo: .caption2) private var priorityRing: CGFloat = 16 | |
| 127 | @ScaledMetric(relativeTo: .caption) private var categoryDot: CGFloat = 6 | |
| 123 | 128 | |
| 124 | 129 | var body: some View { |
| 125 | 130 | HStack(spacing: 6) { |
| @@ -127,11 +132,11 @@ struct WideRow: View { | ||
| 127 | 132 | .font(.caption2.weight(.medium).monospacedDigit()) |
| 128 | 133 | .foregroundStyle(row.statusColor?.color(scheme) ?? .secondary) |
| 129 | 134 | .lineLimit(1) |
| 130 | .frame(width: 72, alignment: .leading) | |
| 135 | .frame(width: gutterWidth, alignment: .leading) | |
| 131 | 136 | if let todo = row.todo { |
| 132 | 137 | let color = row.todoColor?.color(scheme) ?? .secondary |
| 133 | 138 | Text(todo) |
| 134 | .font(.system(size: 9, weight: .bold)) | |
| 139 | .font(.caption2.weight(.bold)) | |
| 135 | 140 | .foregroundStyle(color) |
| 136 | 141 | .padding(.horizontal, 4) |
| 137 | 142 | .padding(.vertical, 1) |
| @@ -140,15 +145,27 @@ struct WideRow: View { | ||
| 140 | 145 | if let priority = row.priority { |
| 141 | 146 | let color = row.priorityColor?.color(scheme) ?? .orange |
| 142 | 147 | Text(priority) |
| 143 | .font(.system(size: 9, weight: .bold)) | |
| 148 | .font(.caption2.weight(.bold)) | |
| 144 | 149 | .foregroundStyle(color) |
| 145 | .frame(width: 14, height: 14) | |
| 150 | .frame(width: priorityRing, height: priorityRing) | |
| 146 | 151 | .overlay(Circle().strokeBorder(color, lineWidth: 1)) |
| 147 | 152 | } |
| 148 | 153 | Text(row.title).font(.caption).lineLimit(1) |
| 149 | 154 | Spacer(minLength: 0) |
| 150 | Circle().fill(row.categoryColor?.color(scheme) ?? .secondary).frame(width: 6, height: 6) | |
| 155 | Circle().fill(row.categoryColor?.color(scheme) ?? .secondary).frame(width: categoryDot, height: categoryDot) | |
| 151 | 156 | } |
| 157 | .accessibilityElement(children: .ignore) | |
| 158 | .accessibilityLabel(label) | |
| 159 | } | |
| 160 | ||
| 161 | /// The time or status, keyword, priority, title and category, as one phrase. | |
| 162 | private var label: Text { | |
| 163 | var parts = [Text(verbatim: row.gutter)] | |
| 164 | if let todo = row.todo { parts.append(Text(verbatim: todo)) } | |
| 165 | if let priority = row.priority { parts.append(Text("Priority \(priority)")) } | |
| 166 | parts.append(Text(verbatim: row.title)) | |
| 167 | if !row.category.isEmpty { parts.append(Text(verbatim: row.category)) } | |
| 168 | return parts.dropFirst().reduce(parts[0]) { $0 + Text(verbatim: ", ") + $1 } | |
| 152 | 169 | } |
| 153 | 170 | } |
| 154 | 171 | |
Tests/OrgAppTests/AgendaSnapshotTests.swift +1 −1
| @@ -74,7 +74,7 @@ struct AgendaSnapshotTests { | ||
| 74 | 74 | let lunch = try #require(rows.first { $0.title == "Lunch" }) |
| 75 | 75 | #expect(lunch.isEvent && lunch.link == nil) |
| 76 | 76 | #expect(lunch.categoryColor == .init(light: "#336699", dark: "#336699")) |
| 77 | #expect(snapshot.colors["agenda-today"] == .init(light: "#007aff", dark: "#0a84ff")) | |
| 77 | #expect(snapshot.colors["agenda-today"] == .init(light: "#0969da", dark: "#0a84ff")) | |
| 78 | 78 | #expect(snapshot.colors["agenda-background"] == nil) |
| 79 | 79 | } |
| 80 | 80 | |
Tests/OrgPresentationTests/PaletteTests.swift +21
| @@ -62,6 +62,27 @@ struct PaletteTests { | ||
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | /// WCAG AA for text: 4.5:1 for every slot drawn as text, in every built-in theme; in | |
| 66 | /// Default, for keywords, priorities and the agenda's colours too. | |
| 67 | @Test func textSlotsReachAA() throws { | |
| 68 | let text = ["foreground", "table", "line-number-current", "tags", "comment", "keyword", "metadata", "syntax-comment", | |
| 69 | "todo-cancelled", "priority-c", "agenda-date", "agenda-time", "agenda-category"] | |
| 70 | let defaults = ["todo", "todo-next", "todo-waiting", "done", "priority", "priority-a", "priority-b", "link", "timestamp", | |
| 71 | "agenda-today", "agenda-overdue", "agenda-due-soon", "agenda-event"] | |
| 72 | for palette in ThemeSpec.palettes(.light) + ThemeSpec.palettes(.dark) { | |
| 73 | let background = try #require(palette.colors["background"]) | |
| 74 | for key in text + (palette.id.hasPrefix("default-") ? defaults : []) { | |
| 75 | let ratio = Self.contrast(try #require(palette.colors[key], "\(palette.id) \(key)"), background) | |
| 76 | #expect(ratio >= 4.5, "\(palette.id) \(key): \(ratio)") | |
| 77 | } | |
| 78 | } | |
| 79 | } | |
| 80 | ||
| 81 | @Test func onlySolarizedIsMarkedLowContrast() { | |
| 82 | let marked = (ThemeSpec.palettes(.light) + ThemeSpec.palettes(.dark)).filter(\.lowContrast).map(\.id) | |
| 83 | #expect(marked == ["solarized-light", "solarized-dark"]) | |
| 84 | } | |
| 85 | ||
| 65 | 86 | @Test func baseTakesEachAppearanceFromItsPalette() throws { |
| 66 | 87 | let (spec, problems) = ThemeSpec.base(light: "paper", dark: "nord") |
| 67 | 88 | #expect(problems.isEmpty) |
docs/manual/guide/13-configuration.org +2
| @@ -691,6 +691,8 @@ The default theme has light and dark colors after GitHub's light and dark themes | ||
| 691 | 691 | |
| 692 | 692 | =light-theme= and =dark-theme= choose a built-in theme for each appearance instead (Settings ▸ Appearance ▸ Theme). The light themes are Default, Solarized Light, Gruvbox Light, Modus Operandi, Catppuccin Latte, Tomorrow and Paper; the dark themes are Default, Solarized Dark, Gruvbox Dark, Modus Vivendi, Catppuccin Mocha, Nord, Dracula, Tokyo Night and doom-one. Every one but Default sets every color key, the sidebar, modeline, agenda and accent included. An unknown name, or one of the other appearance, is reported and Default is used. |
| 693 | 693 | |
| 694 | In every built-in theme, text in a quieter color (tags, comments, keyword lines, planning lines and drawers, cancelled keywords, priority C, agenda times and categories) reads at 4.5:1 or more on the background, the WCAG AA level for body text. Markup characters, block delimiters and line numbers are dimmer. Solarized Light and Solarized Dark keep Solarized's own colors, which put body text and the colored keywords under 4.5:1 in places. Modus Operandi and Modus Vivendi reach 4.5:1 for every color. | |
| 695 | ||
| 694 | 696 | You change any of them by setting colors in =config.toml=, or by keeping a theme in its own file. Copy to Config Folder writes the two chosen themes, every color written out, into =my-theme.toml= and sets =theme-file= to it; it leaves an existing =my-theme.toml= as it is. |
| 695 | 697 | |
| 696 | 698 | Colors are strings in the form ="#rrggbb"= or ="#rrggbbaa"=. They go in these tables: |
docs/manual/guide/14-ios.org +5 −3
| @@ -225,12 +225,14 @@ Tapping a row in the medium or large Today widget opens that entry; tapping else | ||
| 225 | 225 | |
| 226 | 226 | Widgets can't read your folders, so the app writes the next seven days of the agenda (today included) for them to read: while it is open, when files, edits or settings change, when you return to the app, and every hour. Between those times the widgets move on by themselves as timed entries end and at midnight, but they show nothing new until you open orgstar. Until the app has written the agenda once, they say =Open orgstar to show your agenda here.= The widgets ignore the agenda's filter and show no days without entries. The Habits widget's graphs move on at midnight by themselves. |
| 227 | 227 | |
| 228 | In the Habits graph a day's bar has the colour of its state: not yet due, due, due today for the last time, or overdue; days to come are lighter. In the tinted and clear Home Screen styles, and with Differentiate Without Colour on (Settings ▸ Accessibility ▸ Display & Text Size), the states are also told apart by how solid the bar is, from not yet due (faintest) to overdue (solid), and days to come are outlined. In the tinted style, the Today widget's date and the Habits title take the tint. VoiceOver reads each row of the Today widget, each habit and each complication as one item; a habit with how many of the days shown were done and today's state. | |
| 229 | ||
| 228 | 230 | ** Controls |
| 229 | 231 | |
| 230 | 232 | orgstar has two controls for Control Center, the Lock Screen and the Action button. Add them as any control: in Control Center, touch and hold an empty space and tap Add a Control, then choose orgstar. |
| 231 | 233 | |
| 232 | 234 | - Capture :: opens the capture sheet. Touch and hold it while editing Control Center to choose a template; without one it uses the first. |
| 233 | - Clock :: on while a clock runs, showing its entry. Turning it off clocks out; turning it on clocks in to the entry clocked last (Clock In Last). If a clock was left running elsewhere, orgstar asks in the app how to resolve it. | |
| 235 | - Clock :: on while a clock runs, showing its entry; off, it shows Clock In to /heading/ for the entry clocked last. Turning it off clocks out; turning it on clocks in to the entry clocked last (Clock In Last). If a clock was left running elsewhere, orgstar asks in the app how to resolve it. | |
| 234 | 236 | |
| 235 | 237 | ** The clock's Live Activity |
| 236 | 238 | |
| @@ -250,11 +252,11 @@ The widgets and the Live Activity open the app with these links, which also work | ||
| 250 | 252 | |
| 251 | 253 | * Apple Watch |
| 252 | 254 | |
| 253 | The watch app shows today's agenda from your iPhone, marks entries done, shows and stops the running clock, and takes dictated captures. It comes with orgstar on iPhone and installs on a paired watch as other watch apps do. It reads nothing itself: your iPhone sends it today's agenda and the clock whenever its widgets update (when files, edits or settings change while orgstar is open, and when you return to it) and whenever the clock starts or stops, and the watch keeps the last one it got. Until it has one, it says =Open orgstar on your iPhone to show your agenda here.= | |
| 255 | The watch app shows today's agenda from your iPhone, marks entries done, shows and stops the running clock, and takes dictated captures. It comes with orgstar on iPhone and installs on a paired watch as other watch apps do. It reads nothing itself: your iPhone sends it today's agenda and the clock whenever its widgets update (when files, edits or settings change while orgstar is open, and when you return to it) and whenever the clock starts or stops, and the watch keeps the last one it got. Until it has one, it shows only =Open orgstar on your iPhone to show your agenda here.= | |
| 254 | 256 | |
| 255 | 257 | - Clocked In :: the running clock's heading and its time so far, with Clock Out. Without a running clock, Clock In to /heading/ clocks in to the entry clocked last (=org-clock-in-last=). |
| 256 | 258 | - Capture :: dictate or scribble text, then Done. It goes to orgstar on iPhone, which opens the capture sheet with it as =%i=, with the first template, as text from the share sheet does; see Capture below. |
| 257 | - Overdue, then today :: as the agenda lists them, with the time or status, the title and the keyword. Tap an open TODO entry to mark it done: it takes its sequence's first done keyword, as the agenda's Done does. The entry shows done at once; the iPhone changes the file, unless the heading changed since the agenda was sent. | |
| 259 | - Overdue, then today :: as the agenda lists them, with the time or status, the title and the keyword. Keywords are red when open, blue for work under way (NEXT and the like), yellow for work on hold (WAIT and the like), green when done and grey when cancelled; an overdue status is red and one due soon orange. Tap an open TODO entry to mark it done: it takes its sequence's first done keyword, as the agenda's Done does. The entry shows done at once; the iPhone changes the file, unless the heading changed since the agenda was sent. | |
| 258 | 260 | |
| 259 | 261 | What the watch asks for runs on your iPhone, which iOS wakes for it when orgstar isn't open; while the iPhone is out of reach, the requests wait and run when it is back. |
| 260 | 262 | |
docs/manual/guide/15-alongside-emacs.org +1 −1
| @@ -153,7 +153,7 @@ An app started from the Dock doesn't see your shell's =PATH=, which is why orgst | ||
| 153 | 153 | |
| 154 | 154 | * Quick Look |
| 155 | 155 | |
| 156 | orgstar includes a Quick Look extension for org files (=.org= and =.org_archive=). Pressing Space on an org file in Finder, or in the Files app on iOS, shows the file as the HTML export renders it, with its =#+SETUPFILE= keywords applied. The preview reads only UTF-8 files. | |
| 156 | orgstar includes a Quick Look extension for org files (=.org= and =.org_archive=). Pressing Space on an org file in Finder, or in the Files app on iOS, shows the file as the HTML export renders it, with its =#+SETUPFILE= keywords applied. The preview reads a file as UTF-8, or as Latin-1 when it isn't valid UTF-8. | |
| 157 | 157 | |
| 158 | 158 | Inside orgstar, selecting a file in the sidebar that isn't text shows a Quick Look preview, with Open with Default App and Show in Finder below it. |
| 159 | 159 | |
l10n/Localizable.xcstrings +245
| @@ -6001,6 +6001,40 @@ | ||
| 6001 | 6001 | } |
| 6002 | 6002 | } |
| 6003 | 6003 | }, |
| 6004 | "Capture with %@": { | |
| 6005 | "localizations": { | |
| 6006 | "de": { | |
| 6007 | "stringUnit": { | |
| 6008 | "state": "translated", | |
| 6009 | "value": "Mit %@ erfassen" | |
| 6010 | } | |
| 6011 | }, | |
| 6012 | "es": { | |
| 6013 | "stringUnit": { | |
| 6014 | "state": "translated", | |
| 6015 | "value": "Capturar con %@" | |
| 6016 | } | |
| 6017 | }, | |
| 6018 | "fr": { | |
| 6019 | "stringUnit": { | |
| 6020 | "state": "translated", | |
| 6021 | "value": "Capturer avec %@" | |
| 6022 | } | |
| 6023 | }, | |
| 6024 | "ja": { | |
| 6025 | "stringUnit": { | |
| 6026 | "state": "translated", | |
| 6027 | "value": "%@でキャプチャ" | |
| 6028 | } | |
| 6029 | }, | |
| 6030 | "pt-BR": { | |
| 6031 | "stringUnit": { | |
| 6032 | "state": "translated", | |
| 6033 | "value": "Capturar com %@" | |
| 6034 | } | |
| 6035 | } | |
| 6036 | } | |
| 6037 | }, | |
| 6004 | 6038 | "Capture, the agenda, today's entries and the clock, from any app. When off, the menu bar shows orgstar only while a clock runs.": { |
| 6005 | 6039 | "localizations": { |
| 6006 | 6040 | "de": { |
| @@ -10660,6 +10694,40 @@ | ||
| 10660 | 10694 | } |
| 10661 | 10695 | } |
| 10662 | 10696 | }, |
| 10697 | "Done today": { | |
| 10698 | "localizations": { | |
| 10699 | "de": { | |
| 10700 | "stringUnit": { | |
| 10701 | "state": "translated", | |
| 10702 | "value": "Heute erledigt" | |
| 10703 | } | |
| 10704 | }, | |
| 10705 | "es": { | |
| 10706 | "stringUnit": { | |
| 10707 | "state": "translated", | |
| 10708 | "value": "Hecho hoy" | |
| 10709 | } | |
| 10710 | }, | |
| 10711 | "fr": { | |
| 10712 | "stringUnit": { | |
| 10713 | "state": "translated", | |
| 10714 | "value": "Effectuée aujourd'hui" | |
| 10715 | } | |
| 10716 | }, | |
| 10717 | "ja": { | |
| 10718 | "stringUnit": { | |
| 10719 | "state": "translated", | |
| 10720 | "value": "今日は完了" | |
| 10721 | } | |
| 10722 | }, | |
| 10723 | "pt-BR": { | |
| 10724 | "stringUnit": { | |
| 10725 | "state": "translated", | |
| 10726 | "value": "Concluído hoje" | |
| 10727 | } | |
| 10728 | } | |
| 10729 | } | |
| 10730 | }, | |
| 10663 | 10731 | "Doom's own org defaults are read from the folder Doom is installed in": { |
| 10664 | 10732 | "localizations": { |
| 10665 | 10733 | "de": { |
| @@ -13589,6 +13657,40 @@ | ||
| 13589 | 13657 | } |
| 13590 | 13658 | } |
| 13591 | 13659 | }, |
| 13660 | "First template": { | |
| 13661 | "localizations": { | |
| 13662 | "de": { | |
| 13663 | "stringUnit": { | |
| 13664 | "state": "translated", | |
| 13665 | "value": "Erste Vorlage" | |
| 13666 | } | |
| 13667 | }, | |
| 13668 | "es": { | |
| 13669 | "stringUnit": { | |
| 13670 | "state": "translated", | |
| 13671 | "value": "Primera plantilla" | |
| 13672 | } | |
| 13673 | }, | |
| 13674 | "fr": { | |
| 13675 | "stringUnit": { | |
| 13676 | "state": "translated", | |
| 13677 | "value": "Premier modèle" | |
| 13678 | } | |
| 13679 | }, | |
| 13680 | "ja": { | |
| 13681 | "stringUnit": { | |
| 13682 | "state": "translated", | |
| 13683 | "value": "最初のテンプレート" | |
| 13684 | } | |
| 13685 | }, | |
| 13686 | "pt-BR": { | |
| 13687 | "stringUnit": { | |
| 13688 | "state": "translated", | |
| 13689 | "value": "Primeiro modelo" | |
| 13690 | } | |
| 13691 | } | |
| 13692 | } | |
| 13693 | }, | |
| 13592 | 13694 | "Folder": { |
| 13593 | 13695 | "localizations": { |
| 13594 | 13696 | "de": { |
| @@ -17184,6 +17286,40 @@ | ||
| 17184 | 17286 | } |
| 17185 | 17287 | } |
| 17186 | 17288 | }, |
| 17289 | "Last chance today": { | |
| 17290 | "localizations": { | |
| 17291 | "de": { | |
| 17292 | "stringUnit": { | |
| 17293 | "state": "translated", | |
| 17294 | "value": "Heute letzte Gelegenheit" | |
| 17295 | } | |
| 17296 | }, | |
| 17297 | "es": { | |
| 17298 | "stringUnit": { | |
| 17299 | "state": "translated", | |
| 17300 | "value": "Última oportunidad hoy" | |
| 17301 | } | |
| 17302 | }, | |
| 17303 | "fr": { | |
| 17304 | "stringUnit": { | |
| 17305 | "state": "translated", | |
| 17306 | "value": "Dernière chance aujourd'hui" | |
| 17307 | } | |
| 17308 | }, | |
| 17309 | "ja": { | |
| 17310 | "stringUnit": { | |
| 17311 | "state": "translated", | |
| 17312 | "value": "今日が最後の機会" | |
| 17313 | } | |
| 17314 | }, | |
| 17315 | "pt-BR": { | |
| 17316 | "stringUnit": { | |
| 17317 | "state": "translated", | |
| 17318 | "value": "Última chance hoje" | |
| 17319 | } | |
| 17320 | } | |
| 17321 | } | |
| 17322 | }, | |
| 17187 | 17323 | "Later": { |
| 17188 | 17324 | "localizations": { |
| 17189 | 17325 | "de": { |
| @@ -21553,6 +21689,40 @@ | ||
| 21553 | 21689 | } |
| 21554 | 21690 | } |
| 21555 | 21691 | }, |
| 21692 | "No recent clock": { | |
| 21693 | "localizations": { | |
| 21694 | "de": { | |
| 21695 | "stringUnit": { | |
| 21696 | "state": "translated", | |
| 21697 | "value": "Keine letzte Zeiterfassung" | |
| 21698 | } | |
| 21699 | }, | |
| 21700 | "es": { | |
| 21701 | "stringUnit": { | |
| 21702 | "state": "translated", | |
| 21703 | "value": "Sin registro reciente" | |
| 21704 | } | |
| 21705 | }, | |
| 21706 | "fr": { | |
| 21707 | "stringUnit": { | |
| 21708 | "state": "translated", | |
| 21709 | "value": "Aucun chronométrage récent" | |
| 21710 | } | |
| 21711 | }, | |
| 21712 | "ja": { | |
| 21713 | "stringUnit": { | |
| 21714 | "state": "translated", | |
| 21715 | "value": "最近のクロックはありません" | |
| 21716 | } | |
| 21717 | }, | |
| 21718 | "pt-BR": { | |
| 21719 | "stringUnit": { | |
| 21720 | "state": "translated", | |
| 21721 | "value": "Nenhum registro recente" | |
| 21722 | } | |
| 21723 | } | |
| 21724 | } | |
| 21725 | }, | |
| 21556 | 21726 | "Node Graph": { |
| 21557 | 21727 | "localizations": { |
| 21558 | 21728 | "de": { |
| @@ -21825,6 +21995,40 @@ | ||
| 21825 | 21995 | } |
| 21826 | 21996 | } |
| 21827 | 21997 | }, |
| 21998 | "Not due today": { | |
| 21999 | "localizations": { | |
| 22000 | "de": { | |
| 22001 | "stringUnit": { | |
| 22002 | "state": "translated", | |
| 22003 | "value": "Heute nicht fällig" | |
| 22004 | } | |
| 22005 | }, | |
| 22006 | "es": { | |
| 22007 | "stringUnit": { | |
| 22008 | "state": "translated", | |
| 22009 | "value": "No vence hoy" | |
| 22010 | } | |
| 22011 | }, | |
| 22012 | "fr": { | |
| 22013 | "stringUnit": { | |
| 22014 | "state": "translated", | |
| 22015 | "value": "Pas d'échéance aujourd'hui" | |
| 22016 | } | |
| 22017 | }, | |
| 22018 | "ja": { | |
| 22019 | "stringUnit": { | |
| 22020 | "state": "translated", | |
| 22021 | "value": "今日は期限なし" | |
| 22022 | } | |
| 22023 | }, | |
| 22024 | "pt-BR": { | |
| 22025 | "stringUnit": { | |
| 22026 | "state": "translated", | |
| 22027 | "value": "Não vence hoje" | |
| 22028 | } | |
| 22029 | } | |
| 22030 | } | |
| 22031 | }, | |
| 21828 | 22032 | "Not imported": { |
| 21829 | 22033 | "localizations": { |
| 21830 | 22034 | "de": { |
| @@ -36830,6 +37034,47 @@ | ||
| 36830 | 37034 | } |
| 36831 | 37035 | } |
| 36832 | 37036 | }, |
| 37037 | "clock-activity.clock-out": { | |
| 37038 | "comment": "Live Activity button that stops the running clock; keep it short", | |
| 37039 | "localizations": { | |
| 37040 | "de": { | |
| 37041 | "stringUnit": { | |
| 37042 | "state": "translated", | |
| 37043 | "value": "Ausstempeln" | |
| 37044 | } | |
| 37045 | }, | |
| 37046 | "en": { | |
| 37047 | "stringUnit": { | |
| 37048 | "state": "translated", | |
| 37049 | "value": "Clock Out" | |
| 37050 | } | |
| 37051 | }, | |
| 37052 | "es": { | |
| 37053 | "stringUnit": { | |
| 37054 | "state": "translated", | |
| 37055 | "value": "Detener" | |
| 37056 | } | |
| 37057 | }, | |
| 37058 | "fr": { | |
| 37059 | "stringUnit": { | |
| 37060 | "state": "translated", | |
| 37061 | "value": "Arrêter" | |
| 37062 | } | |
| 37063 | }, | |
| 37064 | "ja": { | |
| 37065 | "stringUnit": { | |
| 37066 | "state": "translated", | |
| 37067 | "value": "クロックアウト" | |
| 37068 | } | |
| 37069 | }, | |
| 37070 | "pt-BR": { | |
| 37071 | "stringUnit": { | |
| 37072 | "state": "translated", | |
| 37073 | "value": "Parar Registro" | |
| 37074 | } | |
| 37075 | } | |
| 37076 | } | |
| 37077 | }, | |
| 36833 | 37078 | "comparison with nan": { |
| 36834 | 37079 | "localizations": { |
| 36835 | 37080 | "de": { |