commit 6db5c7e3445d5e121f4422fa884ff78a458f605a
parent ddc27a86bf3b33918c6b54226990b50e5fe9353d
Author: Michael Camilleri <[email protected]>
Date: Sat, 17 Oct 2026 11:44:32 +0900
Add more personality to theme
Diffstat
| M | Notes/Design.md | | | 12 | ++++++++---- |
| M | Reportage/Views/Home/HomeView.swift | | | 39 | +++++++++++++++++++++++++++------------ |
| M | Reportage/Views/Settings/SettingsView.swift | | | 4 | +--- |
| M | Reportage/Views/Theme/Theme.swift | | | 51 | ++++++++++++++++++++++++++++++++++++++++++++++----- |
4 files changed, 82 insertions(+), 24 deletions(-)
diff --git a/Notes/Design.md b/Notes/Design.md
@@ -76,12 +76,16 @@ speaker. Reportage must never do this. See [Ambient noise](#ambient-noise). The look is called Almanac: ink on paper, like a printed journal. -- **Colours** live in `Theme`: paper, ink, a muted grey for secondary text, a - hairline rule and one accent (ultramarine), each with a dark-mode value. - Text keeps at least 4.5:1 contrast against the paper in both modes. +- **Colours** live in `Theme`: a cream paper, ink, a warm muted grey for + secondary text, a hairline rule and one accent (auburn), each with a + dark-mode value. The dark paper is a slightly warm near-black. Text keeps at + least 4.5:1 contrast against the paper in both modes. - **Type:** New York (the system serif) for what the user wrote: entries, prompts, answers and token names. SF for everything around it. Labels such - as dates and report kinds use small spaced capitals. All sizes are Dynamic + as dates and report kinds use small spaced capitals. Screen titles are the + serif in a warm ink softer than the text's; 'Reportage.' over the timeline + is a wordmark: italic, with its full stop in a brighter auburn (rust) than + the accent, since a mark that small has to stand out by colour alone. All sizes are Dynamic Type styles. - **Tabs:** Timeline and Settings, with Visualisations joining them in Phase 7. The timeline keeps its serif 'Reportage' title, beside the quick
diff --git a/Reportage/Views/Home/HomeView.swift b/Reportage/Views/Home/HomeView.swift
@@ -180,10 +180,12 @@ struct HomeHeader: View {
var body: some View {
HStack(alignment: .center) {
- Text("Reportage")
- .font(Theme.serif(.largeTitle, weight: .medium))
- .foregroundStyle(Theme.ink)
- .accessibilityAddTraits(.isHeader)
+ // The app's name is a wordmark: italic, with a full stop in the
+ // mark colour, where other screen titles are upright. VoiceOver
+ // reads the name without the stop.
+ Text("Reportage\(Text(".").foregroundStyle(Theme.mark))", comment: "The app's name in the timeline's title, with a coloured full stop")
+ .screenTitle()
+ .accessibilityLabel(Text("Reportage"))
Spacer()
HStack(spacing: Theme.itemGap) {
QuickLogButton(action: onQuickLog)
@@ -293,7 +295,10 @@ struct ReportRow: View {
var body: some View {
let summary = describer.summary(of: report)
let kind = report.kind.flatMap(ReportKind.init)
- HStack(alignment: .firstTextBaseline, spacing: Theme.itemGap) {
+ // The tops of the time's digits and of the kind label line up,
+ // rather than their baselines, so the small label heads the entry
+ // instead of sitting at the foot of the large digits.
+ HStack(alignment: .capTop, spacing: Theme.itemGap) {
ReportTime(date: report.date, timeZone: report.timeZone)
.frame(width: 60, alignment: .leading)
VStack(alignment: .leading, spacing: 6) {
@@ -354,14 +359,18 @@ struct ReportTime: View {
let date: Date?
let timeZone: String?
+ @ScaledMetric(relativeTo: .title3) private var timeCapHeight = Theme.capHeight(.title3, weight: .medium, design: .serif)
+
var body: some View {
if let date {
let zone = timeZone.flatMap(TimeZone.init(identifier:)) ?? .current
+ let capHeight = timeCapHeight
VStack(alignment: .leading, spacing: Theme.lineGap) {
Text(date, format: Self.format(in: zone))
.font(Theme.serif(.title3, weight: .medium))
.monospacedDigit()
.foregroundStyle(Theme.ink)
+ .alignmentGuide(.capTop) { $0[.firstTextBaseline] - capHeight }
if let period = Self.period(of: date, in: zone) {
Text(period)
.eyebrow()
@@ -396,15 +405,21 @@ struct ReportKindLabel: View {
/// as unfinished: leaving it as it is is fine.
let isLogged: Bool
+ @ScaledMetric(relativeTo: .caption) private var capHeight = Theme.capHeight(.caption1, weight: .semibold)
+
var body: some View {
- if isLogged {
- Text("Instant", comment: "Label for a report logged without answers, such as a quick log")
- .eyebrow()
- .italic()
- } else {
- Text((kind ?? .manual).shortTitle)
- .eyebrow(kind == .wake || kind == .bedtime ? Theme.accent : Theme.muted)
+ let capHeight = capHeight
+ Group {
+ if isLogged {
+ Text("Instant", comment: "Label for a report logged without answers, such as a quick log")
+ .eyebrow()
+ .italic()
+ } else {
+ Text((kind ?? .manual).shortTitle)
+ .eyebrow(kind == .wake || kind == .bedtime ? Theme.accent : Theme.muted)
+ }
}
+ .alignmentGuide(.capTop) { $0[.firstTextBaseline] - capHeight }
}
}
diff --git a/Reportage/Views/Settings/SettingsView.swift b/Reportage/Views/Settings/SettingsView.swift
@@ -193,9 +193,7 @@ private struct WindowPicker: View {
private struct SettingsTitle: View {
var body: some View {
Text("Settings")
- .font(Theme.serif(.largeTitle, weight: .medium))
- .foregroundStyle(Theme.ink)
- .accessibilityAddTraits(.isHeader)
+ .screenTitle()
.frame(minHeight: 44)
.listRowInsets(EdgeInsets(top: 8, leading: Theme.margin, bottom: 20, trailing: Theme.margin))
.listRowBackground(Theme.paper)
diff --git a/Reportage/Views/Theme/Theme.swift b/Reportage/Views/Theme/Theme.swift
@@ -4,15 +4,22 @@ import UIKit
/// The Almanac look: ink on paper, a serif for what the user wrote and a
/// sans serif for everything around it, with one accent colour.
enum Theme {
- static let paper = Color(light: 0xF2F2EE, dark: 0x141517)
+ static let paper = Color(light: 0xF5F0E4, dark: 0x171513)
static let ink = Color(light: 0x1B1C1F, dark: 0xECEBE6)
/// Secondary text. At least 4.5:1 against `paper` in both modes.
- static let muted = Color(light: 0x5C5F66, dark: 0x9C9FA6)
+ static let muted = Color(light: 0x605B53, dark: 0xA29C93)
/// Hairlines between entries and unfilled progress.
- static let rule = Color(light: 0xD4D3CC, dark: 0x34363B)
- static let accent = Color(light: 0x2A44C9, dark: 0x8C9DF5)
+ static let rule = Color(light: 0xDAD2C3, dark: 0x38342E)
+ static let accent = Color(light: 0x8E3B22, dark: 0xE39577)
/// Text and icons drawn on `accent`.
- static let onAccent = Color(light: 0xFFFFFF, dark: 0x141517)
+ static let onAccent = Color(light: 0xFFFFFF, dark: 0x171513)
+ /// The full stop of the 'Reportage.' wordmark: a brighter auburn than
+ /// `accent`, since a mark that small has to stand out by colour alone.
+ /// Decorative, so it needs only 3:1 against `paper`; it's 4.3:1.
+ static let mark = Color(light: 0xC4481A, dark: 0xF2724A)
+ /// Screen titles: a warm ink, softer than `ink` so the title doesn't
+ /// outweigh the entries beneath it.
+ static let titleInk = Color(light: 0x4A433B, dark: 0xC4BDB2)
// MARK: Spacing
//
@@ -47,6 +54,32 @@ enum Theme {
static func serif(_ style: Font.TextStyle, weight: Font.Weight = .regular) -> Font {
.system(style, design: .serif, weight: weight)
}
+
+ /// The cap height of the system font at a text style's default size.
+ /// Scale it with `@ScaledMetric` relative to the same style.
+ static func capHeight(
+ _ style: UIFont.TextStyle, weight: UIFont.Weight,
+ design: UIFontDescriptor.SystemDesign = .default
+ ) -> CGFloat {
+ let traits = UITraitCollection(preferredContentSizeCategory: .large)
+ let base = UIFontDescriptor.preferredFontDescriptor(withTextStyle: style, compatibleWith: traits)
+ .addingAttributes([.traits: [UIFontDescriptor.TraitKey.weight: weight]])
+ let descriptor = base.withDesign(design) ?? base
+ return UIFont(descriptor: descriptor, size: 0).capHeight
+ }
+}
+
+extension VerticalAlignment {
+ private enum CapTop: AlignmentID {
+ static func defaultValue(in dimensions: ViewDimensions) -> CGFloat {
+ dimensions[.top]
+ }
+ }
+
+ /// The top of a text's capitals, for lining up texts of different sizes
+ /// by their tops. A text sets it to its first baseline less its cap
+ /// height.
+ static let capTop = VerticalAlignment(CapTop.self)
}
extension Color {
@@ -71,6 +104,14 @@ extension UIColor {
}
extension View {
+ /// A screen's title, such as 'Reportage' over the timeline: the serif in
+ /// the softer title ink.
+ func screenTitle() -> some View {
+ font(Theme.serif(.largeTitle, weight: .medium))
+ .foregroundStyle(Theme.titleInk)
+ .accessibilityAddTraits(.isHeader)
+ }
+
/// The small spaced capitals used for labels such as dates and report
/// kinds.
func eyebrow(_ color: Color = Theme.muted) -> some View {