Match bonsplit chrome to Ghostty theme

This commit is contained in:
Lawrence Chen 2026-02-22 23:48:13 -08:00
parent 42f1933c80
commit e90b45f75e
2 changed files with 26 additions and 20 deletions

View file

@ -332,28 +332,10 @@ final class Workspace: Identifiable, ObservableObject {
bonsplitAppearance(from: config.backgroundColor)
}
private static func usesDarkChrome(
appAppearance: NSAppearance? = NSApp?.effectiveAppearance
) -> Bool {
guard let appAppearance else { return false }
return appAppearance.bestMatch(from: [.darkAqua, .aqua]) == .darkAqua
}
private static func resolvedChromeBackgroundHex(
from backgroundColor: NSColor,
appAppearance: NSAppearance? = NSApp?.effectiveAppearance
) -> String? {
guard usesDarkChrome(appAppearance: appAppearance) else { return nil }
return backgroundColor.hexString()
}
private static func resolvedChromeColors(
nonisolated static func resolvedChromeColors(
from backgroundColor: NSColor
) -> BonsplitConfiguration.Appearance.ChromeColors {
guard let backgroundHex = resolvedChromeBackgroundHex(from: backgroundColor) else {
return .init()
}
return .init(backgroundHex: backgroundHex)
.init(backgroundHex: backgroundColor.hexString())
}
private static func bonsplitAppearance(from backgroundColor: NSColor) -> BonsplitConfiguration.Appearance {

View file

@ -208,6 +208,30 @@ final class GhosttyConfigTests: XCTestCase {
}
}
final class WorkspaceChromeThemeTests: XCTestCase {
func testResolvedChromeColorsUsesLightGhosttyBackground() {
guard let backgroundColor = NSColor(hex: "#FDF6E3") else {
XCTFail("Expected valid test color")
return
}
let colors = Workspace.resolvedChromeColors(from: backgroundColor)
XCTAssertEqual(colors.backgroundHex, "#FDF6E3")
XCTAssertNil(colors.borderHex)
}
func testResolvedChromeColorsUsesDarkGhosttyBackground() {
guard let backgroundColor = NSColor(hex: "#272822") else {
XCTFail("Expected valid test color")
return
}
let colors = Workspace.resolvedChromeColors(from: backgroundColor)
XCTAssertEqual(colors.backgroundHex, "#272822")
XCTAssertNil(colors.borderHex)
}
}
final class NotificationBurstCoalescerTests: XCTestCase {
func testSignalsInSameBurstFlushOnce() {
let coalescer = NotificationBurstCoalescer(delay: 0.01)