import SwiftUI // MARK: - View ▸ Appearance /// View ▸ Appearance — Auto / Light / Dark (11-command-nexus.md ▸ View; 03-board-ui.md ▸ Toolbar). /// /// **App-wide and always enabled**, unlike `ZoomCommands` beside it in the View menu: appearance is a /// preference about how *every* window in the app draws, welcome included, so this row needs no /// `@FocusedValue` scoping and no board window in front — `NewBoardCommand`'s posture (everywhere, no /// focus required) rather than `ZoomCommands`' (board windows only). /// /// A `Picker` rather than three independent toggles: SwiftUI renders one placed directly in a /// menu-bar command group as a submenu — "Appearance" as its title, "Auto" / "Light" / "Dark" as its /// rows, a checkmark on whichever is selected — which is the three-way exclusive choice a trio of /// `Toggle`s cannot express (nothing stops more than one, or none, from reading as checked). `nil` is /// the Auto tag; `AppearanceStore.setOverride` is the single write path the board-toolbar item shares /// (`BoardZoomStore.step`'s rule — a toolbar item is a menu command with a different face, never a /// second implementation of it). struct AppearanceCommands: View { /// A plain `let` rather than an `@Environment` read, `ZoomCommands`' reason: menu commands live in /// the menu bar, outside every scene's environment; the row re-renders on a change because /// `AppModel` is `@Observable` (`NewBoardCommand`'s pattern). let appModel: AppModel var body: some View { Picker("Appearance", selection: Binding( get: { appModel.appearance.override }, set: { appModel.appearance.setOverride($0) } )) { Text("Auto").tag(nil as AppAppearance?) Text("Light").tag(AppAppearance.light as AppAppearance?) Text("Dark").tag(AppAppearance.dark as AppAppearance?) } } }