diff --git a/packages/notch-mod/.claude-plugin/plugin.json b/packages/notch-mod/.claude-plugin/plugin.json index 8ef1df8..e6a1d46 100644 --- a/packages/notch-mod/.claude-plugin/plugin.json +++ b/packages/notch-mod/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "switchboard-notch", - "version": "0.1.2", + "version": "0.1.3", "description": "Claude's questions drop from your Mac's notch as a native card. Pick with 1-4, type your own answer, or press esc to answer in Claude Code as usual.", "author": { "name": "sameeeeeeep", diff --git a/packages/notch-mod/helper/sb-card b/packages/notch-mod/helper/sb-card index 01c4b3f..99a5e99 100755 Binary files a/packages/notch-mod/helper/sb-card and b/packages/notch-mod/helper/sb-card differ diff --git a/packages/notch-mod/helper/sb-card.swift b/packages/notch-mod/helper/sb-card.swift index a1888e1..edc2b0a 100644 --- a/packages/notch-mod/helper/sb-card.swift +++ b/packages/notch-mod/helper/sb-card.swift @@ -19,6 +19,7 @@ struct CardOption: Decodable { let label: String; let detail: String?; let recom struct CardSpec: Decodable { let title: String?; let question: String; let options: [CardOption] let at: String?; let source: String?; let timeout: Double? + let appearance: String? // "light" | "dark"; omitted = follow the system } // Claude's design language: warm ivory / warm charcoal surfaces, terracotta accent, serif voice. @@ -59,9 +60,9 @@ final class Model: ObservableObject { struct CardView: View { @ObservedObject var m: Model - @Environment(\.colorScheme) var scheme + let dark: Bool @FocusState var fieldFocused: Bool - var p: Palette { scheme == .dark ? .dark : .light } + var p: Palette { dark ? .dark : .light } var shape: UnevenRoundedRectangle { UnevenRoundedRectangle(topLeadingRadius: 12, bottomLeadingRadius: 20, bottomTrailingRadius: 20, topTrailingRadius: 12) @@ -166,13 +167,12 @@ guard CommandLine.arguments.count > 1, let app = NSApplication.shared app.setActivationPolicy(.accessory) -// Test hook: force an appearance (SB_CARD_APPEARANCE=light|dark); otherwise follow the system. -if let a = ProcessInfo.processInfo.environment["SB_CARD_APPEARANCE"] { - app.appearance = NSAppearance(named: a == "dark" ? .darkAqua : .aqua) -} +// Light or dark: the spec can force one (for screenshots); otherwise follow the system. +let isDark = spec.appearance.map { $0 == "dark" } + ?? (app.effectiveAppearance.bestMatch(from: [.darkAqua, .aqua]) == .darkAqua) let model = Model(spec) -let host = NSHostingView(rootView: CardView(m: model)) +let host = NSHostingView(rootView: CardView(m: model, dark: isDark)) host.layoutSubtreeIfNeeded() let size = host.fittingSize