✨ Introduce AccentColorController#814
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new AccentColorController class to manage the app's accent color state globally as a singleton, replacing the previous implementation with automatic color updates through ObservableObject conformance. It also migrates the accent color settings from separate boolean flags (useSystemAccentColor, processWallpaper) to a unified AccentColorMode enum.
Key changes:
- Replaces manual
.onChangecallbacks with automatic color updates throughAccentColorController - Consolidates accent color settings into a single
accentColorModeenum - Adds
DataPatchersystem for handling user settings migration
Reviewed Changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| AccentColorController.swift | Introduces the new singleton controller for managing accent colors with automatic updates |
| AccentColorOption.swift | Defines the new unified enum for accent color modes |
| DataPatcher.swift | Implements migration system for converting old settings to new format |
| RadialMenuView.swift | Updates to use AccentColorController instead of manual color computation |
| PreviewView.swift | Removes manual color state and onChange callbacks, uses AccentColorController |
| WallpaperProcessor.swift | Refactors to instance-based approach and returns colors instead of updating defaults |
| Defaults+Extensions.swift | Adds new keys and deprecates old ones for accent color settings |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
SenpaiHunters
left a comment
There was a problem hiding this comment.
I've been testing it locally for the past two days with all three color modes. I can't see any difference, which is good, so I'll accept it and merge it!
This PR introduces a new class,
AccentColorController, which acts as a singleton to manage the app’s accent color state globally.Compared to the previous implementation, this approach has several advantages:
ObservableObject, any views that depend on this class will automatically update when the accent color changesThe second point is the most impactful change. Previously, many views such as the radial menu and preview window relied on
.onChangecallbacks to refresh their accent color. With this new design, those updates happen automatically. Loop’s settings window also benefits from being more responsive to accent color updates.This PR also adds a new
accentColorModekey to Defaults. It replaces the olderuseSystemAccentColorandprocessWallpaperkeys with a single enum of typeAccentColorMode. This simplifies how Loop handles accent colors, but also required a way to migrate user settings.To handle that migration, this PR introduces a
DataPatcherenum. Itsrun()function is executed at startup and tracks which patches have already been applied. It automatically transitions old user defaults to the new format, and it provides a foundation for handling future data migrations as well.