Commit 741248a32f

741248a32f000514bf746688834089c6ef456912

parent: 326c18adf5

Verified · cmc

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

Widgets: accentable headers, habit states by opacity when tinted

In the tinted and clear styles the Today date and the Habits title take the
tint, and the habit graph uses the opacity steps it uses for Differentiate
Without Colour.

Ref #224

Layout: unified · split

Sources/OrgstarWidgets/HabitsWidget.swift +6 −5
@@ -72,7 +72,7 @@ struct HabitsView: View {
72 let done = snapshot.habits.filter { $0.habit.doneDates.contains(today) }.count 72 let done = snapshot.habits.filter { $0.habit.doneDates.contains(today) }.count
73 return VStack(alignment: .leading, spacing: family == .systemSmall ? 6 : 8) { 73 return VStack(alignment: .leading, spacing: family == .systemSmall ? 6 : 8) {
74 HStack(alignment: .firstTextBaseline) { 74 HStack(alignment: .firstTextBaseline) {
75 Text("Habits").font(.subheadline.weight(.semibold)) 75 Text("Habits").font(.subheadline.weight(.semibold)).widgetAccentable()
76 Spacer(minLength: 0) 76 Spacer(minLength: 0)
77 Text("\(done)/\(snapshot.habits.count) today").font(.caption2.weight(.semibold)).foregroundStyle(.secondary) 77 Text("\(done)/\(snapshot.habits.count) today").font(.caption2.weight(.semibold)).foregroundStyle(.secondary)
78 } 78 }
@@ -104,9 +104,9 @@ struct HabitsView: View {
104} 104}
105 105
106/// org-habit's graph: a bar per day in the due-state color, lighter for days to come, a dot 106/// 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. With Differentiate Without Colour, the state is also 107/// where it was done, today outlined. With Differentiate Without Colour, and in the tinted and
108/// how solid the bar is, from clear (faintest) to overdue (solid), and days to come are 108/// clear styles, which draw every colour in one tint, the state is also how solid the bar is,
109/// outlined. 109/// from clear (faintest) to overdue (solid), and days to come are outlined.
110struct HabitCells: View { 110struct HabitCells: View {
111 let cells: [Habit.Cell] 111 let cells: [Habit.Cell]
112 let colors: [String: AgendaSnapshot.Hex] 112 let colors: [String: AgendaSnapshot.Hex]
@@ -114,8 +114,9 @@ struct HabitCells: View {
114 let height: CGFloat 114 let height: CGFloat
115 @Environment(\.colorScheme) private var scheme 115 @Environment(\.colorScheme) private var scheme
116 @Environment(\.accessibilityDifferentiateWithoutColor) private var differentiateWithoutColor 116 @Environment(\.accessibilityDifferentiateWithoutColor) private var differentiateWithoutColor
117 @Environment(\.widgetRenderingMode) private var renderingMode
117 118
118 private var stepped: Bool { differentiateWithoutColor } 119 private var stepped: Bool { differentiateWithoutColor || renderingMode != .fullColor }
119 120
120 var body: some View { 121 var body: some View {
121 HStack(spacing: 1) { 122 HStack(spacing: 1) {
Sources/OrgstarWidgets/TodayWidget.swift +1
@@ -72,6 +72,7 @@ struct TodayView: View {
72 Text(entry.date, format: family == .systemSmall ? .dateTime.weekday(.abbreviated).day() : .dateTime.weekday(.wide).day().month()) 72 Text(entry.date, format: family == .systemSmall ? .dateTime.weekday(.abbreviated).day() : .dateTime.weekday(.wide).day().month())
73 .font(.subheadline.weight(.semibold)) 73 .font(.subheadline.weight(.semibold))
74 .foregroundStyle(snapshot.color("agenda-today", scheme) ?? .accentColor) 74 .foregroundStyle(snapshot.color("agenda-today", scheme) ?? .accentColor)
75 .widgetAccentable()
75 Spacer(minLength: 0) 76 Spacer(minLength: 0)
76 if overdue > 0, family != .systemSmall { 77 if overdue > 0, family != .systemSmall {
77 Text("\(overdue) overdue") 78 Text("\(overdue) overdue")
docs/manual/guide/14-ios.org +1 −1
@@ -225,7 +225,7 @@ Tapping a row in the medium or large Today widget opens that entry; tapping else
225 225
226Widgets 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. 226Widgets 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
228In 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. 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. 228In 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.
229 229
230** Controls 230** Controls
231 231