refactor(settings): 改用常规关于选项卡并统一蓝色强调色

This commit is contained in:
2026-11-03 20:55:11 +08:00
parent 418fc360c6
commit 7bf8cfff19
15 changed files with 108 additions and 487 deletions
+1 -22
View File
@@ -28,27 +28,6 @@ import CoreGraphics
precondition(SystemAppearanceObserver.isDark(globalDomain: ["AppleInterfaceStyle": "Dark"]))
precondition(!SystemAppearanceObserver.isDark(globalDomain: [:]))
_ = NSApplication.shared
let swatch = CustomColorWell.SwatchButton(frame: CGRect(x: 0, y: 0, width: 44, height: 26))
var clicked = false
swatch.open = { clicked = true }
precondition(swatch.acceptsFirstMouse(for: nil))
swatch.performClick(nil)
precondition(clicked)
swatch.swatchColor = NSColor(srgbRed: 0.2, green: 0.5, blue: 0.9, alpha: 1)
let bitmap = NSBitmapImageRep(bitmapDataPlanes: nil, pixelsWide: 44, pixelsHigh: 26,
bitsPerSample: 8, samplesPerPixel: 4, hasAlpha: true,
isPlanar: false, colorSpaceName: .deviceRGB, bytesPerRow: 0, bitsPerPixel: 0)!
NSGraphicsContext.saveGraphicsState()
NSGraphicsContext.current = NSGraphicsContext(bitmapImageRep: bitmap)
NSColor.clear.setFill()
swatch.bounds.fill(using: .copy)
swatch.draw(swatch.bounds)
NSGraphicsContext.restoreGraphicsState()
let center = bitmap.colorAt(x: 22, y: 13)!.usingColorSpace(.sRGB)!
precondition(abs(center.redComponent - 0.2) < 0.02)
precondition(abs(center.greenComponent - 0.5) < 0.02)
precondition(abs(center.blueComponent - 0.9) < 0.02)
precondition(bitmap.colorAt(x: 0, y: 0)!.alphaComponent == 0)
let global = NSApp.appearance
let window = NSWindow(contentRect: .zero, styleMask: .borderless, backing: .buffered, defer: true)
window.isReleasedWhenClosed = false
@@ -63,6 +42,6 @@ import CoreGraphics
precondition(NSApp.appearance === global)
}
window.close()
print("PASS: outward placement, edge fallback, negative screen origins, vertical limits, explicit/system window appearance reset, independent system resolution, native swatch target/action")
print("PASS: outward placement, edge fallback, negative screen origins, vertical limits, explicit/system window appearance reset, independent system resolution")
}
}