feat(menubar): 支持固定居中面板与独立刷新频率及图表浮层
This commit is contained in:
@@ -5,11 +5,21 @@ import AppKit
|
||||
let bundle = Bundle(path: CommandLine.arguments[1])!
|
||||
for appearance in [NSAppearance.Name.aqua, .darkAqua] {
|
||||
NSAppearance(named: appearance)!.performAsCurrentDrawingAppearance {
|
||||
for name in ["PanelCard", "MetricCPU", "MetricGPU", "MetricMemory", "MetricNetwork", "MetricDisk", "MetricBattery"] {
|
||||
for name in ["PanelCard", "PanelTooltip", "MetricCPU", "MetricGPU", "MetricMemory", "MetricNetwork", "MetricDisk", "MetricBattery", "SeriesUser", "SeriesSystem", "SeriesUpload"] {
|
||||
guard let color = NSColor(named: NSColor.Name(name), bundle: bundle)?.usingColorSpace(.sRGB) else { fatalError("Missing color: \(name)") }
|
||||
precondition(abs(color.alphaComponent - (name == "PanelCard" ? 0.68 : 1)) < 0.005, "Unexpected alpha \(name)")
|
||||
precondition(abs(color.alphaComponent - (name == "PanelCard" ? 0.68 : name == "PanelTooltip" ? 0.97 : 1)) < 0.005, "Unexpected alpha \(name)")
|
||||
if name == "MetricGPU" && appearance == .darkAqua { precondition(color.blueComponent > 0.99) }
|
||||
}
|
||||
let names = ["MetricCPU", "SeriesUser", "SeriesSystem"]
|
||||
let colors = names.map { NSColor(named: NSColor.Name($0), bundle: bundle)!.usingColorSpace(.sRGB)! }
|
||||
for i in 0..<colors.count {
|
||||
for j in (i + 1)..<colors.count {
|
||||
let distance = pow(colors[i].redComponent - colors[j].redComponent, 2)
|
||||
+ pow(colors[i].greenComponent - colors[j].greenComponent, 2)
|
||||
+ pow(colors[i].blueComponent - colors[j].blueComponent, 2)
|
||||
precondition(distance > 0.25, "CPU series hues too close")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
print("PASS: compiled light/dark semantic colors exist, card translucent/semantic colors opaque, GPU blue component is normalized")
|
||||
|
||||
Reference in New Issue
Block a user