Override primaryColor and so on

Is there a way to override the primaryColor by creating an asset color with the same name?

Currently when trying that approach, xcode throws the following warning

"PrimaryColor" color asset name resolves to a conflicting Color symbol "primary". Try renaming the asset.

"PrimaryColor" color asset name resolves to a conflicting Color symbol "primary". Try renaming the asset.

The message is pretty explicit. You cannot override by giving the same name.

See detailed answer in Swift.org: https://forums.swift.org/t/changing-color-primary-and-color-secondary/58838

They are static properties that are controlled by the OS, with the color displayed depending on context (e.g., heading vs. general text) and the user's system settings (such as dark mode vs. light mode).

As you may know, you can set an accentColor which is a broad theme color that is applied to views and controls. May or may not get you in the direction of what you're trying to achieve: https://developer.apple.com/documentation/swiftui/color/accentcolor

Override primaryColor and so on
 
 
Q