- 删除分组实体:分组视图/编辑器/仓储与 groupId 全部移除,升级首启清理 instance-groups.json 与 fleet.groupMode - 新增批量标签表:三态覆盖度(未贴 / N/M / 全部),整批加减与新建标签 - 配色重构,全应用零蓝色:石墨墨色承担主操作与选中态,颜色只留给状态语义; 浅色改中性冷灰,深色改低明度石墨三层 - 选中态改实心主色 + onPrimary,替换不可读的低透明度色雾(主题块、图例胶囊) - 应用图标重做为扁平石墨底 + 黄铜 SIM 面板,参数化光栅化脚本与参考稿 - 运行概览:检测进度并入副标题,读数栅格固定八格两行并保留不可用占位 - 实例详情:仪表改两列发丝线栅格,缺数据留轨道,修掉头部高度回弹; 补齐设备名称/存储总量/可用存储/使用率四个字段名 - 版本号显示去掉括号,设置页只显示 0.2.2 - 文档:新增 docs/ios-native-0.2.2.md,同步 ios-native.md 与两处 README
149 lines
7.2 KiB
Swift
149 lines
7.2 KiB
Swift
import SwiftUI
|
|
|
|
#if canImport(UIKit)
|
|
import UIKit
|
|
#elseif canImport(AppKit)
|
|
import AppKit
|
|
#endif
|
|
|
|
private enum AIPalette {
|
|
#if canImport(UIKit)
|
|
private static func dynamicColor(light: UIColor, dark: UIColor) -> Color {
|
|
Color(
|
|
UIColor { traits in
|
|
traits.userInterfaceStyle == .dark ? dark : light
|
|
})
|
|
}
|
|
|
|
private static func rgba(
|
|
_ red: CGFloat,
|
|
_ green: CGFloat,
|
|
_ blue: CGFloat,
|
|
_ alpha: CGFloat
|
|
) -> UIColor {
|
|
UIColor(red: red / 255, green: green / 255, blue: blue / 255, alpha: alpha)
|
|
}
|
|
|
|
private static func color(light: UIColor, dark: UIColor) -> Color {
|
|
dynamicColor(light: light, dark: dark)
|
|
}
|
|
|
|
// 石墨灰阶:所有中性色 R≈G≈B,不带蓝调;主色让位给黑/白,颜色只用来表达状态。
|
|
static let canvas = color(light: rgba(244, 245, 245, 1), dark: rgba(8, 9, 9, 1))
|
|
static let surface = color(light: rgba(255, 255, 255, 1), dark: rgba(19, 21, 21, 1))
|
|
static let surfaceRaised = color(light: rgba(255, 255, 255, 1), dark: rgba(27, 29, 30, 1))
|
|
static let control = color(light: rgba(238, 239, 239, 1), dark: rgba(36, 39, 40, 1))
|
|
static let tile = color(light: rgba(246, 247, 247, 1), dark: rgba(255, 255, 255, 0.055))
|
|
static let tileLine = color(light: rgba(231, 233, 233, 1), dark: rgba(255, 255, 255, 0.09))
|
|
static let chrome = color(light: rgba(252, 252, 252, 0.92), dark: rgba(11, 12, 12, 0.88))
|
|
static let ink = color(light: rgba(17, 19, 20, 1), dark: rgba(240, 242, 242, 1))
|
|
static let muted = color(light: rgba(88, 94, 97, 1), dark: rgba(158, 165, 168, 1))
|
|
static let faint = color(light: rgba(126, 132, 135, 1), dark: rgba(112, 118, 121, 1))
|
|
static let line = color(light: rgba(223, 226, 226, 1), dark: rgba(255, 255, 255, 0.11))
|
|
static let brand = color(light: rgba(18, 20, 21, 1), dark: rgba(8, 9, 9, 1))
|
|
static let primary = color(light: rgba(21, 24, 25, 1), dark: rgba(238, 241, 241, 1))
|
|
static let onPrimary = color(light: rgba(255, 255, 255, 1), dark: rgba(12, 14, 14, 1))
|
|
static let danger = color(light: rgba(193, 46, 40, 1), dark: rgba(247, 113, 105, 1))
|
|
static let onDanger = color(light: rgba(255, 255, 255, 1), dark: rgba(24, 8, 7, 1))
|
|
static let warning = color(light: rgba(170, 92, 15, 1), dark: rgba(233, 166, 60, 1))
|
|
static let success = color(light: rgba(16, 122, 86, 1), dark: rgba(66, 199, 132, 1))
|
|
static let segmentTrack = color(light: rgba(234, 236, 236, 1), dark: rgba(26, 29, 29, 1))
|
|
static let segmentSelected = color(light: rgba(255, 255, 255, 1), dark: rgba(54, 58, 59, 1))
|
|
static let cardShadow = color(light: rgba(17, 22, 25, 0.06), dark: rgba(0, 0, 0, 0.60))
|
|
#elseif canImport(AppKit)
|
|
static let canvas = Color(red: 0.957, green: 0.961, blue: 0.961)
|
|
static let surface = Color.white
|
|
static let control = Color(red: 0.933, green: 0.937, blue: 0.937)
|
|
static let ink = Color(red: 0.067, green: 0.075, blue: 0.078)
|
|
static let muted = Color(red: 0.345, green: 0.369, blue: 0.380)
|
|
static let line = Color(red: 0.875, green: 0.886, blue: 0.886)
|
|
static let brand = Color(red: 0.071, green: 0.078, blue: 0.082)
|
|
static let surfaceRaised = Color.white
|
|
static let chrome = Color.white.opacity(0.86)
|
|
static let onPrimary = Color.white
|
|
static let onDanger = Color.white
|
|
static let primary = Color(red: 0.082, green: 0.094, blue: 0.098)
|
|
static let danger = Color(red: 0.757, green: 0.180, blue: 0.157)
|
|
static let warning = Color(red: 0.667, green: 0.361, blue: 0.059)
|
|
static let success = Color(red: 0.063, green: 0.478, blue: 0.337)
|
|
static let tile = Color(red: 0.965, green: 0.969, blue: 0.969)
|
|
static let tileLine = Color(red: 0.906, green: 0.914, blue: 0.914)
|
|
static let faint = Color(red: 0.494, green: 0.518, blue: 0.529)
|
|
static let segmentTrack = Color(red: 0.918, green: 0.925, blue: 0.925)
|
|
static let segmentSelected = Color.white
|
|
static let cardShadow = Color(red: 0.067, green: 0.086, blue: 0.098).opacity(0.06)
|
|
#else
|
|
private static func color(_ red: CGFloat, _ green: CGFloat, _ blue: CGFloat) -> Color {
|
|
Color(red: red / 255, green: green / 255, blue: blue / 255)
|
|
}
|
|
|
|
static let canvas = color(243, 245, 248)
|
|
static let surface = color(255, 255, 255)
|
|
static let control = color(247, 249, 251)
|
|
static let ink = color(28, 39, 56)
|
|
static let muted = color(111, 124, 143)
|
|
static let line = color(224, 229, 235)
|
|
static let brand = color(19, 30, 48)
|
|
static let surfaceRaised = color(251, 252, 253)
|
|
static let chrome = color(255, 255, 255, 0.82)
|
|
static let onPrimary = color(255, 255, 255)
|
|
static let onDanger = color(255, 255, 255)
|
|
static let primary = color(17, 20, 25)
|
|
static let danger = color(190, 65, 57)
|
|
static let warning = color(170, 111, 23)
|
|
static let success = color(50, 150, 101)
|
|
static let tile = color(247, 249, 252)
|
|
static let tileLine = color(233, 239, 247)
|
|
static let faint = color(141, 152, 170)
|
|
static let segmentTrack = color(236, 240, 246)
|
|
static let segmentSelected = color(255, 255, 255)
|
|
static let cardShadow = color(15, 30, 60)
|
|
#endif
|
|
}
|
|
|
|
public enum AITheme {
|
|
public static let canvas = AIPalette.canvas
|
|
public static let surface = AIPalette.surface
|
|
public static let surfaceRaised = AIPalette.surfaceRaised
|
|
public static let control = AIPalette.control
|
|
public static let tile = AIPalette.tile
|
|
public static let tileLine = AIPalette.tileLine
|
|
public static let chrome = AIPalette.chrome
|
|
public static let ink = AIPalette.ink
|
|
public static let muted = AIPalette.muted
|
|
public static let faint = AIPalette.faint
|
|
public static let line = AIPalette.line
|
|
public static let brand = AIPalette.brand
|
|
public static let primary = AIPalette.primary
|
|
public static let onPrimary = AIPalette.onPrimary
|
|
public static let danger = AIPalette.danger
|
|
public static let onDanger = AIPalette.onDanger
|
|
public static let warning = AIPalette.warning
|
|
public static let success = AIPalette.success
|
|
public static let segmentTrack = AIPalette.segmentTrack
|
|
public static let segmentSelected = AIPalette.segmentSelected
|
|
public static let cardShadow = AIPalette.cardShadow
|
|
|
|
public static let buttonHeight: CGFloat = 48
|
|
public static let compactButtonHeight: CGFloat = 44
|
|
public static let largeButtonHeight: CGFloat = 56
|
|
public static let toolbarButtonHeight: CGFloat = 44
|
|
// 导航栏只给约 38pt 高度,44pt 的方块会被上下裁切,所以工具栏图标按钮单独取 34。
|
|
public static let iconButtonSize: CGFloat = 34
|
|
public static let iconButtonRadius: CGFloat = 11
|
|
public static let buttonRadius: CGFloat = 16
|
|
public static let cardRadius: CGFloat = 22
|
|
public static let inputRadius: CGFloat = 16
|
|
public static let inputHeight: CGFloat = 52
|
|
public static let segmentedControlHeight: CGFloat = 44
|
|
public static let tileRadius: CGFloat = 14
|
|
public static let chipHeight: CGFloat = 34
|
|
public static let compactControlHeight: CGFloat = 44
|
|
public static let compactButtonMinWidth: CGFloat = 72
|
|
public static let regularButtonMinWidth: CGFloat = 88
|
|
public static let toolbarButtonMinWidth: CGFloat = 96
|
|
public static let toolbarButtonWidth: CGFloat = 104
|
|
public static let footerSecondaryButtonWidth: CGFloat = 104
|
|
public static let listActionButtonWidth: CGFloat = 84
|
|
}
|