Skip to content

✨ Introduce AccentColorController#814

Merged
SenpaiHunters merged 1 commit into
developfrom
accent-color-management
Sep 10, 2025
Merged

✨ Introduce AccentColorController#814
SenpaiHunters merged 1 commit into
developfrom
accent-color-management

Conversation

@mrkai77
Copy link
Copy Markdown
Owner

@mrkai77 mrkai77 commented Sep 7, 2025

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:

  • When the accent color mode is set to wallpaper, Loop will no longer overwrite a user’s custom accent color preferences
  • Because it conforms to ObservableObject, any views that depend on this class will automatically update when the accent color changes

The second point is the most impactful change. Previously, many views such as the radial menu and preview window relied on .onChange callbacks 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 accentColorMode key to Defaults. It replaces the older useSystemAccentColor and processWallpaper keys with a single enum of type AccentColorMode. This simplifies how Loop handles accent colors, but also required a way to migrate user settings.

To handle that migration, this PR introduces a DataPatcher enum. Its run() 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.

@mrkai77 mrkai77 requested a review from Copilot September 7, 2025 09:27
@mrkai77 mrkai77 changed the title ✨ AccentColorController, newly save accentColorMode to UserDefaults ✨ Introduce AccentColorController Sep 7, 2025
Copy link
Copy Markdown

Copilot AI left a 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 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 .onChange callbacks with automatic color updates through AccentColorController
  • Consolidates accent color settings into a single accentColorMode enum
  • Adds DataPatcher system 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.

@mrkai77 mrkai77 self-assigned this Sep 7, 2025
Copy link
Copy Markdown
Collaborator

@SenpaiHunters SenpaiHunters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

@SenpaiHunters SenpaiHunters merged commit 791c1f0 into develop Sep 10, 2025
1 check passed
@SenpaiHunters SenpaiHunters deleted the accent-color-management branch September 10, 2025 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants