master merged
This commit is contained in:
@@ -1,28 +1,38 @@
|
||||
import SwiftUI
|
||||
#if canImport(UIKit)
|
||||
import UIKit
|
||||
#elseif canImport(AppKit)
|
||||
import AppKit
|
||||
#endif
|
||||
|
||||
// MARK: - Colors
|
||||
|
||||
enum AppColors {
|
||||
static let primary = Color(hex: "#1E6B43")
|
||||
static let secondary = Color(hex: "#2F7C4B")
|
||||
static let tertiary = Color(hex: "#8CFF2E")
|
||||
struct AppColors {
|
||||
private init() {}
|
||||
// Brandbook 2026 (Pedi Foods)
|
||||
// Primary now follows the "FOODS" dark green tone from the logo.
|
||||
static let primary = Color(.sRGB, red: 52/255.0, green: 93/255.0, blue: 84/255.0, opacity: 1.0)
|
||||
// Secondary keeps the vivid lime from the symbol/logo body.
|
||||
static let secondary = Color(.sRGB, red: 213/255.0, green: 216/255.0, blue: 65/255.0, opacity: 1.0)
|
||||
static let tertiary = Color(.sRGB, red: 167/255.0, green: 191/255.0, blue: 66/255.0, opacity: 1.0)
|
||||
|
||||
static let brandDark = Color(hex: "#1B5C3A")
|
||||
static let brandSoft = Color(hex: "#E8F2EC")
|
||||
static let brandDark = Color(.sRGB, red: 31/255.0, green: 45/255.0, blue: 64/255.0, opacity: 1.0)
|
||||
static let brandSoft = Color(.sRGB, red: 242/255.0, green: 245/255.0, blue: 227/255.0, opacity: 1.0)
|
||||
|
||||
static let backgroundLight = Color(hex: "#F3F5F7")
|
||||
static let backgroundDark = Color(hex: "#18230F")
|
||||
static let surface = Color(hex: "#FFFFFF")
|
||||
static let textPrimary = Color(hex: "#1C1F23")
|
||||
static let textInverse = Color(hex: "#FFFFFF")
|
||||
static let textMuted = Color(hex: "#7B8794")
|
||||
static let backgroundLight = Color(.sRGB, red: 243/255.0, green: 245/255.0, blue: 247/255.0, opacity: 1.0)
|
||||
static let backgroundDark = Color(.sRGB, red: 31/255.0, green: 45/255.0, blue: 64/255.0, opacity: 1.0)
|
||||
static let surface = Color.white
|
||||
static let textPrimary = Color.black
|
||||
static let textInverse = Color.white
|
||||
static let textMuted = Color(.sRGB, red: 102/255.0, green: 112/255.0, blue: 133/255.0, opacity: 1.0)
|
||||
}
|
||||
|
||||
enum AppDarkColors {
|
||||
static let background = Color(hex: "#18230F")
|
||||
static let surface = Color(hex: "#FFFFFF", alpha: 0.05)
|
||||
static let textPrimary = Color(hex: "#FFFFFF")
|
||||
static let textSecondary = Color(hex: "#A3A3A3")
|
||||
struct AppDarkColors {
|
||||
private init() {}
|
||||
static let background = Color(.sRGB, red: 31/255.0, green: 45/255.0, blue: 64/255.0, opacity: 1.0)
|
||||
static let surface = Color.white.opacity(0.08)
|
||||
static let textPrimary = Color.white
|
||||
static let textSecondary = Color(.sRGB, red: 208/255.0, green: 213/255.0, blue: 221/255.0, opacity: 1.0)
|
||||
static let primary = AppColors.primary
|
||||
static let secondary = AppColors.secondary
|
||||
static let tertiary = AppColors.tertiary
|
||||
@@ -30,28 +40,46 @@ enum AppDarkColors {
|
||||
|
||||
// MARK: - Typography
|
||||
|
||||
enum AppTypography {
|
||||
static let fontFamily = "Plus Jakarta Sans"
|
||||
struct AppTypography {
|
||||
private init() {}
|
||||
// Brandbook typography: Nexa (fallback: system font)
|
||||
static let fontFamily = "Nexa-Regular"
|
||||
|
||||
// Avoid applying dynamic weight on custom font descriptors to prevent
|
||||
// SwiftUI runtime warnings on some platforms/toolchains.
|
||||
static let heading1 = Font.custom(fontFamily, size: 28)
|
||||
static let heading25 = Font.custom(fontFamily, size: 25)
|
||||
static let heading2 = Font.custom(fontFamily, size: 20)
|
||||
static let heading3 = Font.custom(fontFamily, size: 16)
|
||||
static let body = Font.custom(fontFamily, size: 16)
|
||||
static let button = Font.custom(fontFamily, size: 14)
|
||||
static let caption = Font.custom(fontFamily, size: 10)
|
||||
static let overline = Font.custom(fontFamily, size: 11)
|
||||
static let heading1 = resolvedFont(size: 28, fallbackWeight: .bold)
|
||||
static let heading25 = resolvedFont(size: 25, fallbackWeight: .bold)
|
||||
static let heading2 = resolvedFont(size: 20, fallbackWeight: .semibold)
|
||||
static let heading3 = resolvedFont(size: 16, fallbackWeight: .semibold)
|
||||
static let body = resolvedFont(size: 16, fallbackWeight: .regular)
|
||||
static let button = resolvedFont(size: 14, fallbackWeight: .semibold)
|
||||
static let caption = resolvedFont(size: 10, fallbackWeight: .regular)
|
||||
static let overline = resolvedFont(size: 11, fallbackWeight: .regular)
|
||||
|
||||
static let bodyLineHeight: CGFloat = 1.6
|
||||
static let buttonLetterSpacing: CGFloat = 0.08
|
||||
static let captionLetterSpacing: CGFloat = 0.12
|
||||
|
||||
private static func resolvedFont(size: CGFloat, fallbackWeight: Font.Weight) -> Font {
|
||||
if isBrandFontAvailable {
|
||||
return Font.custom(fontFamily, size: size)
|
||||
}
|
||||
return .system(size: size, weight: fallbackWeight, design: .default)
|
||||
}
|
||||
|
||||
private static var isBrandFontAvailable: Bool {
|
||||
#if canImport(UIKit)
|
||||
return UIFont(name: fontFamily, size: 16) != nil
|
||||
#elseif canImport(AppKit)
|
||||
return NSFont(name: fontFamily, size: 16) != nil
|
||||
#else
|
||||
return false
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Layout
|
||||
|
||||
enum AppLayout {
|
||||
struct AppLayout {
|
||||
private init() {}
|
||||
static let radiusMD: CGFloat = 12
|
||||
static let radiusLG: CGFloat = 16
|
||||
static let radiusXL: CGFloat = 24
|
||||
@@ -68,7 +96,8 @@ struct ShadowSpec {
|
||||
let y: CGFloat
|
||||
}
|
||||
|
||||
enum AppShadow {
|
||||
struct AppShadow {
|
||||
private init() {}
|
||||
static let soft = ShadowSpec(color: Color.black.opacity(0.08), radius: 20, y: 6)
|
||||
static let glow = ShadowSpec(color: AppColors.tertiary.opacity(0.2), radius: 24, y: 8)
|
||||
}
|
||||
@@ -79,7 +108,9 @@ extension Color {
|
||||
init(hex: String, alpha: Double = 1.0) {
|
||||
let cleaned = hex.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)
|
||||
var int: UInt64 = 0
|
||||
Scanner(string: cleaned).scanHexInt64(&int)
|
||||
if let val = UInt64(cleaned, radix: 16) {
|
||||
int = val
|
||||
}
|
||||
|
||||
let r, g, b: UInt64
|
||||
switch cleaned.count {
|
||||
|
||||
Reference in New Issue
Block a user