Commit 2a9597a69f
Unsigned
Layout: unified · split
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 | } |