-
Notifications
You must be signed in to change notification settings - Fork 48
feat: Add comprehensive dark mode support #14
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?
Conversation
Updated UserDetailPage, TagDetailPage, and Webview to use adaptive colors: - Replaced hardcoded .white with Color.primaryText/itemBackground - Replaced .black with Color.primaryText - Replaced .gray with Color.secondaryText - Updated CSS colors in Webview for proper dark mode support - Adjusted overlay opacity for better visibility in both themes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Remove UIUserInterfaceStyle restriction from Info.plist to allow system theme - Create adaptive color system with light/dark variants for all UI elements - Add 15 new color sets with proper dark mode support - Implement appearance settings with light/dark/system options - Update main app to apply user's color scheme preference - Add appearance toggle in settings page with Chinese localization - Update key views to use adaptive colors instead of hardcoded values - Fix navigation bar appearance to adapt to dark mode - Add @retroactive attribute to fix UINavigationController extension warning - Make color properties public to fix accessibility issues This enables full dark mode support throughout the app, automatically adapting to system preferences or user's manual selection. 🤖 Generated with Claude Code Co-Authored-By: Claude <[email protected]>
Code Coverage Report ❌Current coverage: 0% |
- Replace primaryText overlay with dynamic(light: .black, dark: .white) to maintain proper darkening effect in light mode and lightening in dark mode - Fixes build issues by moving SettingActions into SettingState temporarily - Restores original overlay opacity values (0.3/0.1)
Code Coverage Report ❌Current coverage: 0% |
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.
Pull Request Overview
This PR implements comprehensive dark mode support by introducing adaptive color assets, updating UI components to use semantic color references, and adding appearance settings to persist and apply the user’s theme preference.
- Added 15 new semantic color asset sets and updated Color.swift with dynamic color utilities
- Replaced hard-coded colors across views/widgets with adaptive Color references
- Introduced Appearance settings UI, state, actions, and reducer to save/load the preferred theme
Reviewed Changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
website | Updated submodule commit |
V2er/View/Widget/Toast.swift | Use Color.itemBackground and Color.primaryText for blur/shadow |
V2er/View/Widget/TabBar.swift | Replace static white with Color.itemBackground |
V2er/View/Widget/SectionItemView.swift | Update chevron tint and background to semantic colors |
V2er/View/Widget/RichTextView/Webview.swift | Update inline CSS colors to semantic hex values |
V2er/View/ViewExtension.swift | Added @retroactive attribute on UINavigationController |
V2er/View/Tag/TagDetailPage.swift | Apply Color.primaryText and dynamic overlay for banner blur |
V2er/View/Settings/AppearanceSettingView.swift | New theme selection UI using adaptive colors |
V2er/View/Me/UserDetailPage.swift | Updated navbar, badges, tabs to use semantic colors |
V2er/View/Me/MePage.swift | Replace login prompt and list item colors with adaptive references |
V2er/View/Login/LoginPage.swift | Update separators and button text/background to theme assets |
V2er/State/DataFlow/State/SettingState.swift | Define AppearanceMode , load/save from UserDefaults |
V2er/State/DataFlow/Reducers/SettingReducer.swift | Implement ChangeAppearanceAction handling in reducer |
V2er/Info.plist | Removed forced UIUserInterfaceStyle |
V2er/General/V2erApp.swift | Apply .preferredColorScheme and dynamic nav bar appearance |
V2er/General/Color.swift | Define new semantic/dynamic colors and legacy aliases |
V2er/Assets.xcassets | Added multiple color asset sets for light/dark mode |
Comments suppressed due to low confidence (2)
V2er/State/DataFlow/Reducers/SettingReducer.swift:11
- The new reducer logic for
ChangeAppearanceAction
lacks automated tests. Adding unit tests for this reducer will ensure future changes don’t break theme persistence behavior.
func settingStateReducer(_ state: SettingState, _ action: Action) -> (SettingState, Action?) {
V2er/View/ViewExtension.swift:104
- The
@retroactive
attribute is not a valid Swift attribute for protocol conformance and will cause a compile error. Replace or remove it (e.g., useextension UINavigationController: UIGestureRecognizerDelegate
).
extension UINavigationController: @retroactive UIGestureRecognizerDelegate {
} | ||
} | ||
|
||
// Temporary: Define actions here until SettingActions.swift is properly added to project |
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.
Defining SettingActions
in this file is noted as temporary. Consider moving the ChangeAppearanceAction
and related action definitions into a dedicated SettingActions.swift
for clearer boundaries and easier future maintenance.
Copilot uses AI. Check for mistakes.
var body: some View { | ||
formView | ||
.navBar("外观设置") | ||
.onAppear { | ||
selectedAppearance = store.appState.settingState.appearance | ||
} |
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.
The local selectedAppearance
state is only initialized on appear. If the store’s appearance
changes externally, the UI won’t update. Consider adding .onChange(of: store.appState.settingState.appearance)
to keep the selection in sync.
} | |
} | |
.onChange(of: store.appState.settingState.appearance) { newAppearance in | |
selectedAppearance = newAppearance | |
} |
Copilot uses AI. Check for mistakes.
public static let bodyText = Color("BodyText") | ||
public static let tintColor = Color("TintColor") | ||
public static let bgColor = Color("BackgroundColor") | ||
public static let itemBg = Color("ItemBackground") |
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.
[nitpick] The legacy alias itemBg
duplicates itemBackground
. After migrating all usages, consider removing redundant aliases to avoid confusion.
public static let itemBg = Color("ItemBackground") |
Copilot uses AI. Check for mistakes.
The @retroactive attribute is only available in Swift 6, but the CI uses an older version of Swift. Removing this attribute to fix the build failure.
Code Coverage Report ❌Current coverage: 25.06% |
- Change NodeView text from hardcoded black to primaryText color - Add secondaryText color to comment count labels for better visibility - Add Appearance Settings option to Settings page menu
Code Coverage Report ❌Current coverage: 25.06% |
- Use dynamic colors for NodeView text (#666666 light, #CCCCCC dark) - Ensure proper contrast between text and background in both modes
Code Coverage Report ❌Current coverage: 18.57% |
Summary
Changes
Test plan
🤖 Generated with Claude Code