Widgets: add shared WidgetTheme + BarGrid (foundation)

Groundwork for the slate-background / brand-orange widget re-theme and the
new bar-style event countdown:
- WidgetTheme (dark slate background, brand orange accent, text tones).
- BarGrid: vertical-bar (comb) progress view.

Re-theming the existing widgets and adding the bars widget follows.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
kutesir
2026-06-10 17:18:52 +03:00
parent a191cebeed
commit 063df4ba03
3 changed files with 56 additions and 17 deletions

View File

@@ -1,6 +1,41 @@
import SwiftUI
import WidgetKit
// MARK: - Shared widget theme (slate background + brand orange)
enum WidgetTheme {
static let background = Color(red: 0.224, green: 0.255, blue: 0.310) // dark slate
static let accent = Color(red: 0.93, green: 0.42, blue: 0.20) // brand orange
static let text = Color.white
static let textDim = Color.white.opacity(0.55)
static let textFaint = Color.white.opacity(0.4)
}
// MARK: - Vertical-bar progress (comb / equalizer style)
struct BarGrid: View {
let progress: Double // 01
let color: Color
var count: Int = 64
var gap: CGFloat = 3
var body: some View {
GeometryReader { geo in
let totalGap = gap * CGFloat(count - 1)
let barW = max(1.5, (geo.size.width - totalGap) / CGFloat(count))
let filled = Int((progress * Double(count)).rounded())
HStack(spacing: gap) {
ForEach(0..<count, id: \.self) { i in
RoundedRectangle(cornerRadius: barW / 2)
.fill(i < filled ? color : color.opacity(0.22))
.frame(width: barW)
}
}
.frame(height: geo.size.height, alignment: .center)
}
}
}
// MARK: - Dot-grid progress (day / week / month / year)
enum TimePeriod { case day, week, month, year }