Let’s make our app stand out with custom accent colors, and verify that it works nicely in light, dark, and high contrast mode.

YouTube

Deprecated Way

This method still works, but has been deprecated. Let’s define the AccentColor in Assets instead.

ContentView()
    .accentColor(Color.purple)

New Way

Steps

  1. In the Xcode Navigator…
  2. Select Assets
  3. Select AccentColor

We can set custom colors for different devices and display modes, but let’s use a system color for now. Using a provided system color means the OS handles all the different display modes for us.

  1. Select Universal
  2. Set the universal color to systemPurpleColor

Resources

HIG: Visual Design Color .systemPurple

Diff

 {
   "colors" : [
     {
+      "color" : {
+        "platform" : "universal",
+        "reference" : "systemPurpleColor"
+      },
       "idiom" : "universal"
     }
   ],