diff --git a/FuelBoard/StationsView.swift b/FuelBoard/StationsView.swift index 6e01e14..54ec67e 100644 --- a/FuelBoard/StationsView.swift +++ b/FuelBoard/StationsView.swift @@ -317,17 +317,6 @@ extension FuelType { case .diesel: return "Diesel" } } - - /// Fuel colour wheel (user-chosen palette): green = unleaded (#30D158), - /// yellow = premium (#FFD60A), cyan = diesel (#64D2FF). Used for the - /// fuel-type tab icons and the title icon. - var tintColor: Color { - switch self { - case .e10: return Color(red: 48/255.0, green: 209/255.0, blue: 88/255.0) // #30D158 - case .e5: return Color(red: 255/255.0, green: 214/255.0, blue: 10/255.0) // #FFD60A - case .diesel: return Color(red: 100/255.0, green: 210/255.0, blue: 255/255.0) // #64D2FF - } - } } /// Fuel-type selector styled like a segmented control, with a coloured pump diff --git a/FuelBoardWidgets/FuelBoardLiveActivityView.swift b/FuelBoardWidgets/FuelBoardLiveActivityView.swift index 4c51e37..49d9cd9 100644 --- a/FuelBoardWidgets/FuelBoardLiveActivityView.swift +++ b/FuelBoardWidgets/FuelBoardLiveActivityView.swift @@ -41,7 +41,7 @@ struct FuelBoardLiveActivity: Widget { } } compactLeading: { Image(systemName: "fuelpump.fill") - .foregroundStyle(.green) + .foregroundStyle(context.state.fuel.tintColor) } compactTrailing: { FuelBoardLiveActivityPriceView(context: context) } minimal: { @@ -95,7 +95,7 @@ private struct FuelBoardLiveActivityView: View { // LEFT — station brand glyph Image(systemName: "fuelpump.circle.fill") .font(.system(size: 32)) - .foregroundStyle(.green, .white) + .foregroundStyle(context.state.fuel.tintColor, .white) .frame(width: 40, height: 40) // MIDDLE — fuel + station diff --git a/Shared/FuelStore.swift b/Shared/FuelStore.swift index c47b2c6..6b51ed5 100644 --- a/Shared/FuelStore.swift +++ b/Shared/FuelStore.swift @@ -8,6 +8,7 @@ // keychain → app-group defaults → fallback. import Foundation +import SwiftUI import Security #if canImport(AppIntents) import AppIntents @@ -99,6 +100,20 @@ enum FuelType: String, Codable, CaseIterable, Identifiable { } } +/// Fuel colour wheel (user-chosen palette): green = unleaded (#30D158), +/// yellow = premium (#FFD60A), cyan = diesel (#64D2FF). Lives here in Shared +/// so the app, widget, and Live Activity all tint the pump/fuel glyphs from one +/// definition. +extension FuelType { + var tintColor: Color { + switch self { + case .e10: return Color(red: 48/255.0, green: 209/255.0, blue: 88/255.0) // #30D158 + case .e5: return Color(red: 255/255.0, green: 214/255.0, blue: 10/255.0) // #FFD60A + case .diesel: return Color(red: 100/255.0, green: 210/255.0, blue: 255/255.0) // #64D2FF + } + } +} + #if canImport(AppIntents) extension FuelType: AppEnum {} #endif