fix(memory): 对齐概念图配色与底栏排版

This commit is contained in:
2026-11-03 16:57:38 +08:00
parent c566831889
commit b3f5b07e81
7 changed files with 164 additions and 6 deletions
+4
View File
@@ -219,3 +219,7 @@ GPU 专项第二轮:已完成 LLDB 失败分支定位、探针调用原样转
- 压力只显示系统等级;缓存单独显示,不叠加到容量分类。
- 实际面板视觉验收待重新运行;构建与采样检查见本轮交付。
- 本轮签名 Debug 构建通过;MemoryChecks 通过 48 GiB 换算、零值/缺失值和分类总和验证。本机采样总量 48.0 GiB,已用约 38.1 GiB、缓存约 7.8 GiB、压力等级 1(正常)。保留用户原有进程,未重新启动面板,完整 UI 展示尚未实测。
### 内存卡片配色与底栏细化
- 使用独立内存色板:应用亮蓝、联动淡紫、压缩琥珀、可用灰,分布条和图例共用顺序,避免复用其他指标颜色导致漂移。
- 底栏三项均为左对齐双行,等宽列之间加入两条竖线;用量标题改为总利用率。
@@ -0,0 +1,38 @@
{
"colors": [
{
"idiom": "universal",
"color": {
"color-space": "srgb",
"components": {
"red": "0.141176",
"green": "0.458824",
"blue": "0.823529",
"alpha": "1.000"
}
}
},
{
"idiom": "universal",
"color": {
"color-space": "srgb",
"components": {
"red": "0.196078",
"green": "0.596078",
"blue": "1.000000",
"alpha": "1.000"
}
},
"appearances": [
{
"appearance": "luminosity",
"value": "dark"
}
]
}
],
"info": {
"author": "xcode",
"version": 1
}
}
@@ -0,0 +1,38 @@
{
"colors": [
{
"idiom": "universal",
"color": {
"color-space": "srgb",
"components": {
"red": "0.678431",
"green": "0.701961",
"blue": "0.749020",
"alpha": "1.000"
}
}
},
{
"idiom": "universal",
"color": {
"color-space": "srgb",
"components": {
"red": "0.384314",
"green": "0.423529",
"blue": "0.486275",
"alpha": "1.000"
}
},
"appearances": [
{
"appearance": "luminosity",
"value": "dark"
}
]
}
],
"info": {
"author": "xcode",
"version": 1
}
}
@@ -0,0 +1,38 @@
{
"colors": [
{
"idiom": "universal",
"color": {
"color-space": "srgb",
"components": {
"red": "0.678431",
"green": "0.447059",
"blue": "0.050980",
"alpha": "1.000"
}
}
},
{
"idiom": "universal",
"color": {
"color-space": "srgb",
"components": {
"red": "0.964706",
"green": "0.737255",
"blue": "0.282353",
"alpha": "1.000"
}
},
"appearances": [
{
"appearance": "luminosity",
"value": "dark"
}
]
}
],
"info": {
"author": "xcode",
"version": 1
}
}
@@ -0,0 +1,38 @@
{
"colors": [
{
"idiom": "universal",
"color": {
"color-space": "srgb",
"components": {
"red": "0.474510",
"green": "0.329412",
"blue": "0.780392",
"alpha": "1.000"
}
}
},
{
"idiom": "universal",
"color": {
"color-space": "srgb",
"components": {
"red": "0.643137",
"green": "0.541176",
"blue": "0.949020",
"alpha": "1.000"
}
},
"appearances": [
{
"appearance": "luminosity",
"value": "dark"
}
]
}
],
"info": {
"author": "xcode",
"version": 1
}
}
@@ -3,7 +3,7 @@ import SwiftUI
struct MemoryDetailsView: View {
let memory: MemoryMetrics
@Environment(\.accessibilityReduceMotion) private var reduceMotion
private var colors: [Color] { [Color("MetricMemory"), Color("MetricNetwork"), Color("MetricDisk"), .secondary.opacity(0.25)] }
private var colors: [Color] { [Color("MemoryApplication"), Color("MemoryWired"), Color("MemoryCompressed"), Color("MemoryAvailable")] }
private var values: [UInt64] { [memory.app, memory.wired, memory.compressed, memory.available] }
private let labels: [LocalizedStringKey] = ["memory.app", "memory.wired", "memory.compressed", "memory.available"]
@@ -13,8 +13,8 @@ struct MemoryDetailsView: View {
HStack {
Text("memory.distribution").fontWeight(.semibold)
Spacer()
Text("panel.total").foregroundStyle(.secondary)
AnimatedMetricText(value: MetricFormat.percent(memory.usage)).foregroundStyle(Color("MetricMemory"))
Text("gpu.totalUtilization").foregroundStyle(.secondary)
AnimatedMetricText(value: MetricFormat.percent(memory.usage)).foregroundStyle(Color("MemoryApplication"))
}
GeometryReader { proxy in
HStack(spacing: 0) {
@@ -45,11 +45,13 @@ struct MemoryDetailsView: View {
Text("memory.pressure").foregroundStyle(.secondary)
pressure
}.frame(maxWidth: .infinity, alignment: .leading)
Divider().frame(height: 30)
VStack(alignment: .leading, spacing: 4) {
Text("memory.cached").foregroundStyle(.secondary)
AnimatedMetricText(value: MetricFormat.memory(memory.cached))
}.frame(maxWidth: .infinity, alignment: .leading)
.help(Text("memory.cachedHelp"))
Divider().frame(height: 30)
VStack(alignment: .leading, spacing: 4) {
Text("memory.swap").foregroundStyle(.secondary)
AnimatedMetricText(value: MetricFormat.memory(memory.swapUsed))
+3 -3
View File
@@ -231,12 +231,12 @@ struct MenuPanelView: View {
}.font(.system(size: 10)).help(Text("gpu.pipelineHelp"))
}
private var memoryCard: some View {
ResourceCard(title: "metric.memory", symbol: "memorychip", color: Color("MetricMemory"),
ResourceCard(title: "metric.memory", symbol: "memorychip", color: Color("MemoryApplication"),
value: snapshot.memory.map { String(format: "%.1f / %.0f GiB", Double($0.used) / 1_073_741_824, Double($0.total) / 1_073_741_824) } ?? "--") {
PanelTrendChart(dates: samples.map(\.date),
first: samples.map { $0.memory.map { $0 * Double(snapshot.memory?.total ?? 1) } },
color: Color("MetricMemory"), fixedScale: Double(snapshot.memory?.total ?? 1),
scaleLabel: MetricFormat.memory(snapshot.memory?.total), firstValueFormat: .memory,
color: Color("MemoryApplication"), fixedScale: Double(snapshot.memory?.total ?? 1),
scaleLabel: MetricFormat.memory(snapshot.memory?.total), firstValueFormat: .memory, firstLabel: "gpu.totalUtilization",
expectedInterval: chartInterval, boundaryDates: chartBoundaries, intervals: chartIntervals)
if let memory = snapshot.memory {
MemoryDetailsView(memory: memory)