Commit 0f215ef0ee
0f215ef0eea92267b482a00d2c7adff7c59197c7
parent: 4a31811ff2
Verified · cmc
cmc <hello@cleberg.net> · 2026-08-28T03:00:04Z
activity graph: the stylesheet's ramp, not an invented one
The graph shipped green with opacity steps I chose myself. The web
mixes --accent toward --bg at 25/50/75/100 with --faint for an empty
day, and the cells are 11px. Adding --faint and --bg as tokens and
using them.
The level thresholds happened to match activityLevel; that was luck,
not care, and they are now stated as matching it.
Every other token was checked against style.css in the same pass: all
ten already matched exactly.
gitbay/Theme/Theme.swift
+5
| @@ -32,6 +32,11 @@ extension Color { |
| 32 | 32 | nonisolated static let gbCodeBackground = paired(0xF5F5F5, 0x050505) |
| 33 | 33 | /// --fill-subtle: hunk headers and quiet fills. |
| 34 | 34 | nonisolated static let gbFillSubtle = paired(0xECECEC, 0x161616) |
| 35 | /// --faint: hairlines, row separators, and an empty calendar cell. |
| 36 | nonisolated static let gbFaint = paired(0xEAEAEA, 0x1C1C1C) |
| 37 | /// --bg: the page ground the accent is mixed toward. Chrome uses the |
| 38 | /// system background; this is for blends that must match the web. |
| 39 | nonisolated static let gbBackground = paired(0xFFFFFF, 0x0A0A0A) |
| 35 | 40 | } |
| 36 | 41 | |
| 37 | 42 | extension UIColor { |
gitbay/Views/Discovery/ActivityGraph.swift
+10 −7
| @@ -55,7 +55,7 @@ struct ActivityGraph: View { |
| 55 | 55 | let date: String |
| 56 | 56 | let count: Int |
| 57 | 57 | |
| 58 | | /// Five buckets, as the stylesheet colors them. |
| 58 | /// The same five buckets activityLevel uses server-side. |
| 59 | 59 | var level: Int { |
| 60 | 60 | switch count { |
| 61 | 61 | case 0: 0 |
| @@ -75,7 +75,7 @@ struct ActivityGraph: View { |
| 75 | 75 | ForEach(Array(week.enumerated()), id: \.offset) { _, cell in |
| 76 | 76 | RoundedRectangle(cornerRadius: 2) |
| 77 | 77 | .fill(color(for: cell)) |
| 78 | | .frame(width: 10, height: 10) |
| 78 | .frame(width: 11, height: 11) |
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | } |
| @@ -85,14 +85,17 @@ struct ActivityGraph: View { |
| 85 | 85 | .defaultScrollAnchor(.trailing) |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | /// The stylesheet's ramp: an empty day is --faint, and the rest mix |
| 89 | /// --accent toward --bg at 25/50/75/100 percent. A day outside the |
| 90 | /// window draws nothing at all. |
| 88 | 91 | private func color(for cell: Cell?) -> Color { |
| 89 | 92 | guard let cell else { return .clear } |
| 90 | 93 | return switch cell.level { |
| 91 | | case 0: Color.gbFillSubtle |
| 92 | | case 1: Color.gbOK.opacity(0.30) |
| 93 | | case 2: Color.gbOK.opacity(0.55) |
| 94 | | case 3: Color.gbOK.opacity(0.78) |
| 95 | | default: Color.gbOK |
| 94 | case 0: Color.gbFaint |
| 95 | case 1: Color.gbAccent.mix(with: .gbBackground, by: 0.75) |
| 96 | case 2: Color.gbAccent.mix(with: .gbBackground, by: 0.50) |
| 97 | case 3: Color.gbAccent.mix(with: .gbBackground, by: 0.25) |
| 98 | default: Color.gbAccent |
| 96 | 99 | } |
| 97 | 100 | } |
| 98 | 101 | } |