diff options
| author | Christian Cleberg <[email protected]> | 2026-07-20 18:16:01 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-07-20 18:50:57 -0500 |
| commit | eb8a0d30da0cc150e95d44bad998c13ee2defc25 (patch) | |
| tree | 1ad349e302b5b48bbc9f79d17a66bcfc31dace11 /DomainDigWidget | |
| parent | 1e25fb947d3c01fc983b481fff5b064ed82349ab (diff) | |
| download | domain-dig-eb8a0d30da0cc150e95d44bad998c13ee2defc25.tar.gz domain-dig-eb8a0d30da0cc150e95d44bad998c13ee2defc25.tar.bz2 domain-dig-eb8a0d30da0cc150e95d44bad998c13ee2defc25.zip | |
feat(a11y): semantic colour system (#21 phase 1)
Replaces every hard-coded colour with semantic asset colours that adapt to
light, dark, and Increase Contrast. Dark mode stays locked, so this is a
pure refactor: the audit reports the same findings before and after.
The accent is now blue rather than cyan, per the tech/DNS theme.
Why custom values rather than the system palette: every system colour
fails WCAG AA in light mode. Measured on white — systemYellow 1.51:1,
systemOrange 2.20:1, systemGreen 2.22:1, systemCyan 2.54:1, systemRed
3.55:1. All of them pass in dark mode, which is why the dark-locked app
looked fine, and why unlocking light mode was never a matter of deleting
.preferredColorScheme(.dark). Every new value clears 4.5:1 as text on its
page, its card, and its own 16% badge tint — the way AppStatusBadgeView
actually draws it.
The accent needed splitting in two. As text on a dark background it must
be light; as a fill behind a white label it must be dark. #4DA3FF reads
8.00:1 as text on black but 2.63:1 behind white text, so StatusInfo /
AccentColor cover the foreground role and AccentFill covers
.borderedProminent. AppOnAccent is the label colour for a solid fill and
flips by scheme.
Colours live in Shared/Colors.xcassets rather than the app catalog: the
Shared folder is already a synchronized group in all three targets, so
the widget and share extension pick the palette up with no project-file
surgery. AccentColor stays in the app catalog as the global tint — and is
now actually defined, having been an empty colorset that silently left
system controls rendering in stock blue while custom chrome used cyan.
Two deliberate visual changes: orange folds into StatusWarning and pink
into StatusCritical. They encoded the same severity as the colours they
now share, and both sites also carry a text label.
Audit findings drop 15 to 14, and one of the originals turned out to be
a phantom: the Inspect contrast failure was the Run button in its
disabled state, which WCAG 1.4.3 exempts. testInspectScreen now types a
domain first so the audit measures an enabled control. Findings also
carry the offending element now, so the remaining clipped-text items name
themselves ("No Portfolio Yet", "Search domains") instead of being
anonymous.
Diffstat (limited to 'DomainDigWidget')
| -rw-r--r-- | DomainDigWidget/DomainDigPortfolioWidget.swift | 20 | ||||
| -rw-r--r-- | DomainDigWidget/SweepLiveActivity.swift | 12 |
2 files changed, 16 insertions, 16 deletions
diff --git a/DomainDigWidget/DomainDigPortfolioWidget.swift b/DomainDigWidget/DomainDigPortfolioWidget.swift index bc88ac0..a3335c8 100644 --- a/DomainDigWidget/DomainDigPortfolioWidget.swift +++ b/DomainDigWidget/DomainDigPortfolioWidget.swift @@ -91,9 +91,9 @@ struct DomainDigWidgetView: View { Spacer(minLength: 0) HStack(spacing: 10) { - countPill(data.healthyCount, .green) - countPill(data.warningCount, .orange) - countPill(data.criticalCount, .red) + countPill(data.healthyCount, Color(.statusPositive)) + countPill(data.warningCount, Color(.statusWarning)) + countPill(data.criticalCount, Color(.statusCritical)) } } } @@ -121,10 +121,10 @@ struct DomainDigWidgetView: View { } HStack(spacing: 12) { - summaryStat(data.healthyCount, "Healthy", .green) - summaryStat(data.warningCount, "Warning", .orange) - summaryStat(data.criticalCount, "Critical", .red) - summaryStat(data.expiringSoonCount, "Expiring", .yellow) + summaryStat(data.healthyCount, "Healthy", Color(.statusPositive)) + summaryStat(data.warningCount, "Warning", Color(.statusWarning)) + summaryStat(data.criticalCount, "Critical", Color(.statusCritical)) + summaryStat(data.expiringSoonCount, "Expiring", Color(.statusWarning)) } Divider() @@ -180,9 +180,9 @@ struct DomainDigWidgetView: View { private func color(for status: DomainDigWidgetStatus) -> Color { switch status { - case .healthy: return .green - case .warning: return .orange - case .critical: return .red + case .healthy: return Color(.statusPositive) + case .warning: return Color(.statusWarning) + case .critical: return Color(.statusCritical) } } } diff --git a/DomainDigWidget/SweepLiveActivity.swift b/DomainDigWidget/SweepLiveActivity.swift index b99a070..b96f8bf 100644 --- a/DomainDigWidget/SweepLiveActivity.swift +++ b/DomainDigWidget/SweepLiveActivity.swift @@ -24,7 +24,7 @@ struct SweepLiveActivity: Widget { DynamicIslandExpandedRegion(.bottom) { VStack(alignment: .leading, spacing: 4) { ProgressView(value: context.state.fractionComplete) - .tint(.cyan) + .tint(Color(.statusInfo)) if let current = context.state.currentDomain { Text(current) .font(.caption2) @@ -35,7 +35,7 @@ struct SweepLiveActivity: Widget { } } compactLeading: { Image(systemName: "arrow.trianglehead.2.clockwise") - .foregroundStyle(.cyan) + .foregroundStyle(Color(.statusInfo)) } compactTrailing: { Text("\(context.state.completed)/\(context.state.total)") .font(.caption2) @@ -43,7 +43,7 @@ struct SweepLiveActivity: Widget { } minimal: { ProgressView(value: context.state.fractionComplete) .progressViewStyle(.circular) - .tint(.cyan) + .tint(Color(.statusInfo)) } } } @@ -66,7 +66,7 @@ private struct SweepActivityBannerView: View { } ProgressView(value: context.state.fractionComplete) - .tint(.cyan) + .tint(Color(.statusInfo)) HStack { if let current = context.state.currentDomain { @@ -83,12 +83,12 @@ private struct SweepActivityBannerView: View { if context.state.changed > 0 { Text("\(context.state.changed) changed") .font(.caption2) - .foregroundStyle(.orange) + .foregroundStyle(Color(.statusWarning)) } if context.state.warnings > 0 { Text("\(context.state.warnings) warnings") .font(.caption2) - .foregroundStyle(.red) + .foregroundStyle(Color(.statusCritical)) } } } |
