-
Notifications
You must be signed in to change notification settings - Fork 51
feat: add adaptive appearance settings #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import SwiftUI | ||
|
|
||
| enum AppAppearance: String, CaseIterable, Hashable { | ||
| case system | ||
| case light | ||
| case dark | ||
|
|
||
| var label: String { | ||
| switch self { | ||
| case .system: "System" | ||
| case .light: "Light" | ||
| case .dark: "Dark" | ||
| } | ||
| } | ||
|
|
||
| var colorScheme: ColorScheme? { | ||
| switch self { | ||
| case .system: nil | ||
| case .light: .light | ||
| case .dark: .dark | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @MainActor | ||
| final class AppearanceStore: ObservableObject { | ||
| static let shared = AppearanceStore() | ||
| static let key = "MacIsland.appearance" | ||
|
|
||
| @Published var appearance: AppAppearance { | ||
| didSet { | ||
| UserDefaults.standard.set(appearance.rawValue, forKey: Self.key) | ||
| } | ||
|
Comment on lines
+25
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n -C 4 \
'AppearanceStore\.shared|preferredColorScheme|NSApp\.appearance|NSApplication\.shared\.appearance|NSAppearance\(named:' \
SourcesRepository: ericjypark/codex-island Length of output: 2837 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf 'Tracked Swift files:\n'
git ls-files 'Sources/*.swift' 'Sources/**/*.swift' | sed -n '1,120p'
printf '\nAppearanceStore reference summary:\n'
rg -n 'AppearanceStore|AppAppearance|NSAppearance|window\.appearance|appearance =|\.colorScheme|`@MainActor`' Sources
printf '\nMain app files:\n'
for f in $(git ls-files 'Sources/*.swift' 'Sources/**/*.swift' | grep -E 'App|Entry|main|AppDelegate|Scene' || true); do
echo "--- $f"
wc -l "$f"
doneRepository: ericjypark/codex-island Length of output: 8190 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '--- Sources/App.swift ---\n'
cat -n Sources/App.swift
printf '\n--- Sources/Window/IslandWindowController.swift ---\n'
wc -l Sources/Window/IslandWindowController.swift
sed -n '1,280p' Sources/Window/IslandWindowController.swift | cat -n
printf '\n--- Sources/Views/IslandRootView.swift ---\n'
wc -l Sources/Views/IslandRootView.swift
sed -n '1,240p' Sources/Views/IslandRootView.swift | cat -nRepository: ericjypark/codex-island Length of output: 252 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- Sources/App.swift ---'
cat -n Sources/App.swift
printf '%s\n' ''
printf '%s\n' '--- Sources/Window/IslandWindowController.swift ---'
wc -l Sources/Window/IslandWindowController.swift
sed -n '1,280p' Sources/Window/IslandWindowController.swift | cat -n
printf '%s\n' ''
printf '%s\n' '--- Sources/Views/IslandRootView.swift ---'
wc -l Sources/Views/IslandRootView.swift
sed -n '1,240p' Sources/Views/IslandRootView.swift | cat -nRepository: ericjypark/codex-island Length of output: 28505 Wire
🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| private init() { | ||
| let raw = UserDefaults.standard.string(forKey: Self.key) ?? "" | ||
| appearance = AppAppearance(rawValue: raw) ?? .dark | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Use a clear list for appearance modes.
Write
light, dark, or system appearanceinstead oflight/dark/system appearance. This improves readability and removes the slash compound.Proposed wording
📝 Committable suggestion
🧰 Tools
🪛 LanguageTool
[uncategorized] ~187-~187: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...k/system appearance, Always show usage, Low Power Mode, configurable limit alerts, and ...
(EN_COMPOUND_ADJECTIVE_INTERNAL)
🤖 Prompt for AI Agents
Source: Linters/SAST tools