Files
FamilyMealPlanner/MealMood/Extensions/Color+MealMood.swift
T
alexandrev-tibco e593453abd Version casi lista
2026-02-17 13:34:02 +01:00

32 lines
1.0 KiB
Swift

import SwiftUI
extension Color {
// Primary
static let mealMoodCoral = Color(hex: "#FFB4A2")
static let mealMoodMint = Color(hex: "#B8E6D5")
// Background
static let mealMoodBackground = Color(hex: "#FFF9F5")
static let mealMoodSurface = Color.white
// Text
static let mealMoodTextPrimary = Color(hex: "#2D2D2D")
static let mealMoodTextSecondary = Color(hex: "#6B6B6B")
// Feedback
static let mealMoodSuccess = Color(hex: "#A8D5BA")
static let mealMoodWarning = Color(hex: "#FFD6A5")
static let mealMoodError = Color(hex: "#FF9999")
init(hex: String) {
let scanner = Scanner(string: hex)
scanner.currentIndex = hex.hasPrefix("#") ? hex.index(after: hex.startIndex) : hex.startIndex
var rgb: UInt64 = 0
scanner.scanHexInt64(&rgb)
let r = Double((rgb & 0xFF0000) >> 16) / 255.0
let g = Double((rgb & 0x00FF00) >> 8) / 255.0
let b = Double(rgb & 0x0000FF) / 255.0
self.init(red: r, green: g, blue: b)
}
}