diff --git a/FuelBoardWidgets/FuelPriceWidget.swift b/FuelBoardWidgets/FuelPriceWidget.swift index 6e67dbb..9eee29e 100644 --- a/FuelBoardWidgets/FuelPriceWidget.swift +++ b/FuelBoardWidgets/FuelPriceWidget.swift @@ -2,6 +2,21 @@ import WidgetKit import SwiftUI import AppIntents +// Fuel colour wheel — mirrors the app's palette in StationsView.swift +// (FuelType.tintColor): green = unleaded (#30D158), yellow = premium +// (#FFD60A), cyan = diesel (#64D2FF). Kept here (widget target) because +// Shared/FuelStore.swift is Foundation-only by design; if the app's copy +// ever moves to Shared, DELETE this duplicate to avoid redeclaration. +private extension FuelType { + var fuelColor: 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 + } + } +} + // FuelBoard widget — petrol stations near you. // FuelPriceWidget (medium): top 3 stations with price + distance, each row // opens Maps. Per-widget fuel + sort (+ distance for Cheapest). @@ -398,7 +413,7 @@ struct FuelPriceWidgetView: View { return VStack(alignment: .leading, spacing: 6) { HStack { Image(systemName: "fuelpump.fill") - .foregroundStyle(.green) + .foregroundStyle(entry.fuel.fuelColor) Text(heading) .font(.caption2) .foregroundStyle(.secondary) @@ -440,7 +455,7 @@ struct FuelPriceWidgetView: View { return VStack(alignment: .leading, spacing: 6) { HStack { Image(systemName: "fuelpump.fill") - .foregroundStyle(.green) + .foregroundStyle(entry.fuel.fuelColor) Text(heading) .font(.caption2) .foregroundStyle(.secondary)