63 lines
2.3 KiB
Swift
63 lines
2.3 KiB
Swift
//
|
||
// AppDesign.swift
|
||
// suixinkan
|
||
//
|
||
// Created by Codex on 2026/6/18.
|
||
//
|
||
|
||
import SwiftUI
|
||
|
||
/// 应用通用颜色定义,集中管理跨页面复用的设计色值。
|
||
enum AppDesign {
|
||
static let primary = Color(hex: 0x0073FF)
|
||
static let primarySoft = Color(hex: 0xEFF6FF)
|
||
static let textPrimary = Color(hex: 0x1F2937)
|
||
static let textSecondary = Color(hex: 0x6B7280)
|
||
static let placeholder = Color(hex: 0xA8B2C1)
|
||
static let success = Color(hex: 0x14964A)
|
||
static let warning = Color(hex: 0xFF7B00)
|
||
|
||
// MARK: - 订单列表专用色值(对齐 Android OrderListScreen)
|
||
|
||
static let orderPageBackground = Color(hex: 0xF5F5F5)
|
||
static let orderInputBackground = Color(hex: 0xF4F4F4)
|
||
static let orderLabelColor = Color(hex: 0x4B5563)
|
||
static let orderBorderLight = Color(hex: 0xEEEEEE)
|
||
static let orderRefundText = Color(hex: 0xEF4444)
|
||
static let orderRefundBackground = Color(hex: 0xFFE7E7)
|
||
static let orderStatusPaidText = Color(hex: 0x0073FF)
|
||
static let orderStatusPaidBackground = Color(hex: 0xEFF6FF)
|
||
static let orderStatusCompletedText = Color(hex: 0x10B981)
|
||
static let orderStatusCompletedBackground = Color(hex: 0xF0FDF4)
|
||
static let orderStatusRefundedText = Color(hex: 0xEF4444)
|
||
static let orderStatusRefundedBackground = Color(hex: 0xFFE7E7)
|
||
static let orderStatusOtherText = Color(hex: 0xFF7B00)
|
||
static let orderStatusOtherBackground = Color(hex: 0xFFF0E2)
|
||
}
|
||
|
||
extension Color {
|
||
/// 通过 0xRRGGBB 和透明度创建 SwiftUI Color。
|
||
init(hex: UInt, alpha: Double = 1.0) {
|
||
self.init(
|
||
.sRGB,
|
||
red: Double((hex >> 16) & 0xff) / 255.0,
|
||
green: Double((hex >> 8) & 0xff) / 255.0,
|
||
blue: Double(hex & 0xff) / 255.0,
|
||
opacity: alpha
|
||
)
|
||
}
|
||
}
|
||
|
||
extension View {
|
||
/// 应用通用输入框背景、圆角和描边样式。
|
||
func appInputFieldStyle(cornerRadius: CGFloat, minHeight: CGFloat) -> some View {
|
||
padding(.horizontal, AppMetrics.Spacing.medium)
|
||
.frame(minHeight: minHeight)
|
||
.background(Color(hex: 0xF8FAFC), in: RoundedRectangle(cornerRadius: cornerRadius))
|
||
.overlay {
|
||
RoundedRectangle(cornerRadius: cornerRadius)
|
||
.stroke(Color(hex: 0xE2E8F0), lineWidth: 1)
|
||
}
|
||
}
|
||
}
|