feat: 对齐小程序品牌色与渐变设计 tokens
This commit is contained in:
@@ -1,12 +1,70 @@
|
||||
import SwiftUI
|
||||
|
||||
/// 设计 tokens(颜色 / 间距 / 圆角),对应 Android DesignSystem。
|
||||
/// 设计 tokens(颜色 / 渐变 / 间距 / 圆角),对应 Android DesignSystem。
|
||||
public enum DS {
|
||||
public enum Color {
|
||||
public static let accent = SwiftUI.Color.accentColor
|
||||
public static let success = SwiftUI.Color.green
|
||||
public static let danger = SwiftUI.Color.red
|
||||
public static let danger = SwiftUI.Color(hex: 0xC0392B)
|
||||
public static let warning = SwiftUI.Color.orange
|
||||
|
||||
// 品牌色(对齐「明缘云道场」小程序 / android-client designsystem)
|
||||
public static let brandDark = SwiftUI.Color(hex: 0x2C1810)
|
||||
public static let brandGold = SwiftUI.Color(hex: 0xC67B30)
|
||||
public static let brandPaper = SwiftUI.Color(hex: 0xFDFBF7)
|
||||
public static let planBackground = SwiftUI.Color(hex: 0xF6F2EC)
|
||||
public static let brandBrown = SwiftUI.Color(hex: 0x5A4A3A)
|
||||
public static let brandMuted = SwiftUI.Color(hex: 0x8B7A6A)
|
||||
public static let brandLightAmber = SwiftUI.Color(hex: 0xE3B37C)
|
||||
public static let amberMid = SwiftUI.Color(hex: 0xE4A05E)
|
||||
public static let brandChip = SwiftUI.Color(hex: 0xF6EFE6)
|
||||
public static let brandCream = SwiftUI.Color(hex: 0xE8DCCB)
|
||||
public static let faintText = SwiftUI.Color(hex: 0xB6A996)
|
||||
public static let disabled = SwiftUI.Color(hex: 0xD8C7B4)
|
||||
|
||||
// 打卡状态色
|
||||
public static let statusNormal = SwiftUI.Color(hex: 0x2E7D32)
|
||||
public static let statusNormalBright = SwiftUI.Color(hex: 0x43A047)
|
||||
public static let statusLate = SwiftUI.Color(hex: 0xC67B30)
|
||||
public static let statusLeave = SwiftUI.Color(hex: 0x3A7BD5)
|
||||
public static let statusEarlyLeave = SwiftUI.Color(hex: 0x8B7A6A)
|
||||
public static let statusAbsent = SwiftUI.Color(hex: 0xC0392B)
|
||||
public static let dangerBright = SwiftUI.Color(hex: 0xE5736C)
|
||||
|
||||
// 完成 / 未完成底色
|
||||
public static let fillDone = SwiftUI.Color(hex: 0xE8F4EB)
|
||||
public static let fillUndone = SwiftUI.Color(hex: 0xFFF3E6)
|
||||
}
|
||||
|
||||
public enum Gradient {
|
||||
/// 首页顶部深咖啡色渐变(135°)。
|
||||
public static let hero = LinearGradient(
|
||||
colors: [
|
||||
SwiftUI.Color(hex: 0x2C1810),
|
||||
SwiftUI.Color(hex: 0x4A2B1D),
|
||||
SwiftUI.Color(hex: 0x6B3F24),
|
||||
],
|
||||
startPoint: .topLeading,
|
||||
endPoint: .bottomTrailing
|
||||
)
|
||||
|
||||
public static let amber = LinearGradient(
|
||||
colors: [SwiftUI.Color(hex: 0xC67B30), SwiftUI.Color(hex: 0xE4A05E)],
|
||||
startPoint: .top,
|
||||
endPoint: .bottom
|
||||
)
|
||||
|
||||
public static let avatar = LinearGradient(
|
||||
colors: [SwiftUI.Color(hex: 0xC67B30), SwiftUI.Color(hex: 0xE3B37C)],
|
||||
startPoint: .top,
|
||||
endPoint: .bottom
|
||||
)
|
||||
|
||||
public static let groupTile = LinearGradient(
|
||||
colors: [SwiftUI.Color(hex: 0xF3E3CF), SwiftUI.Color(hex: 0xFBE7D1)],
|
||||
startPoint: .topLeading,
|
||||
endPoint: .bottomTrailing
|
||||
)
|
||||
}
|
||||
|
||||
public enum Spacing {
|
||||
@@ -23,3 +81,16 @@ public enum DS {
|
||||
public static let lg: CGFloat = 16
|
||||
}
|
||||
}
|
||||
|
||||
extension SwiftUI.Color {
|
||||
/// 从 0xRRGGBB 十六进制值构造颜色。
|
||||
init(hex: UInt32, 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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user