diff --git a/Sources/Workspace.swift b/Sources/Workspace.swift index 572fbc57..6c8d20cc 100644 --- a/Sources/Workspace.swift +++ b/Sources/Workspace.swift @@ -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 { diff --git a/cmuxTests/GhosttyConfigTests.swift b/cmuxTests/GhosttyConfigTests.swift index effff6ad..25946b38 100644 --- a/cmuxTests/GhosttyConfigTests.swift +++ b/cmuxTests/GhosttyConfigTests.swift @@ -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)