Repository navigation
feat(ui): migrate SwiftUI views to DashUIKit color tokens for dark mode - #849
Conversation
Move the shared component library (Button, Dialogs, MenuItem, SegmentedControl, NavigationBar, Toast, Icons, steppers, intros, …) off the app-local Color+DWStyle tokens and hardcoded literals onto Color.dash.* — DashUIKit's asset-backed tokens with proper light/dark variants. Replaces drag-handle literals with Color.dash.grabberFill, modal scrims with Color.dash.backgroundOverlay, and white-on-colored content with Color.dash.whiteText. Adds `import DashUIKit` where newly needed. First batch of the dark-mode color sweep.
Sweep the feature views (Payments, Home, DashPay, Explore/DashSpend, Swap, Coinbase, Buy&Sell, CrowdNode, Menu, Auth, Tx, shared Views) off the app-local Color+DWStyle tokens, hardcoded literals, and SwiftUI system semantics onto DashUIKit's Color.dash.* — asset-backed tokens with proper light/dark variants. - app tokens → Color.dash.* by name (primaryText, secondaryBackground, gray300, …) - .foregroundColor(.secondary/.primary) → Color.dash.secondaryText/primaryText - white-on-colored content → Color.dash.whiteText; drag handles → grabberFill; modal/screen scrims → backgroundOverlay; black-opacity shadows → shadow - UIKit-context UIColor.system* left as-is (already appearance-adaptive); legacy ObjC/UIKit views out of scope; algorithmic avatar colors left as-is - adds `import DashUIKit` where newly needed Full `dashpay` build verified green prior to the final trivial token swaps.
The payments hero tab selector filled its selected pill with pure white and labeled it with primaryText, so in dark mode the (light) label sat on white and vanished. Make the selected fill adaptive — white in light, translucent white (whiteAlpha20) in dark — via @Environment(\.colorScheme), mirroring DashUIKit's SegmentedControl, and move the inactive label to Color.dash.secondaryText. Likewise the "Customize shortcut bar" banner used a fixed white background under adaptive primaryText; switch it to Color.dash.secondaryBackground so the card surface inverts with the text.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
QuantumExplorer
left a comment
There was a problem hiding this comment.
The namespace migration is broadly mechanical and the diff is clean, but two token choices still defeat the dark-mode goal and should be corrected before merge. I left inline details below.
Non-blocking cleanup: this patch also adds import DashUIKit to ten files with no other changes, and the new PaymentsLandingScreen comment says it mirrors a DashUIKit SegmentedControl even though the pinned package has no such component (the matching implementation is app-local).
Verification: reviewed the full 126-file diff at 013ce4af; git diff --check passes. The only configured PR checks are title validation and CodeRabbit (skipped), so there is no independent build result attached to the PR.
| private var separatorView: some View { | ||
| Rectangle() | ||
| .fill(Color.black.opacity(0.3)) | ||
| .fill(Color.dash.black.opacity(0.3)) |
There was a problem hiding this comment.
Dark-mode regression: DashUIKit’s Black asset is a single fixed near-black value, so this separator still disappears against the dark background. Please use an adaptive semantic color (for example Color.dash.primaryText.opacity(0.3)) or a dedicated divider token so it remains visible in both appearances.
| HStack { | ||
| Image(systemName: "magnifyingglass") | ||
| .foregroundColor(.gray) | ||
| .foregroundColor(Color.dash.gray500) |
There was a problem hiding this comment.
Dark-mode regression: DashUIKit’s Gray500 asset is fixed #525C66 and has no dark appearance, so this icon becomes very low-contrast on the dark surface. The same replacement appears in MerchantFiltersView.swift:292 and MasternodesScreen.swift:176; please use an adaptive semantic token such as tertiaryText/secondaryText for all three.
Issue being fixed or feature implemented
The app follows the system appearance (it is not pinned to light mode), but many SwiftUI views used non-adaptive colors: hardcoded literals (
Color.white,Color.black,Color(red:…)) and app-localColor+DWStyletokens where only 26 of 125 colorsets carry a dark variant. In dark mode this produced broken visuals — invisible drag handles, a white-on-white selected tab pill, black shadows/scrims, and fixed-white cards under light text.What was done?
Migrated color usage across the SwiftUI view tree to DashUIKit's
Color.dash.*tokens (asset-backed with proper light/dark variants):Color.dash.*by name (primaryText,secondaryBackground,gray300,blueAlpha10, …)..foregroundColor(.secondary/.primary)→Color.dash.secondaryText/primaryText.grabberFill, modal/screen scrims →backgroundOverlay, black-opacity shadows →shadow, white-on-colored content →whiteText.@Environment(\.colorScheme)+ the best-fitting token (e.g. the payments hero selected-tab pill: white in light,whiteAlpha20in dark, mirroring DashUIKitSegmentedControl); the "Customize shortcut bar" banner moved tosecondaryBackground.import DashUIKitadded where newly needed.Out of scope, deliberately unchanged: legacy ObjC/UIKit views,
UIColor.system*(already appearance-adaptive), andContactAvatarView's algorithmic hue-generated colors.Three commits: shared components, remaining feature views, and the dark-mode tab/banner fix.
How Has This Been Tested?
Full
dashpaybuild green (xcodebuild ... -scheme dashpay -sdk iphonesimulator ARCHS=arm64 build). Ran on device in dark mode and fixed the reported white-on-white active tab pill; a further dark-mode spot-check across all screens is recommended before merge.Breaking Changes
None. Visual-only; no behavior changes.
Checklist:
For repository code-owners and collaborators only