在 AppShortcut() 中确保已经添加 shortTitle 和 systemImageName 参数。如果你的快捷方式都没有这个,彩色面板将不会出现在快捷方式应用程序中。系统图像名称来自SF Symbols。

appshortcuts设置

创建颜色

在主应用的资产目录中创建颜色(例如 ShortcutsBackground1 、 ShortcutsBackground2 和 ShortcutsForeground)

两个背景色,一个前景色。

添加颜色

修改plist

现在在Info.plist中添加 NSAppIconActionTintColorName 和 NSAppIconComplementingColorNames 。这需要在 CFBundlePrimaryIcon 中进行。

添加规则

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<dict>
.....
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
....

<key>NSAppIconActionTintColorName</key>
<string>ShortcutsForeground</string>
<key>NSAppIconComplementingColorNames</key>
<array>
<string>ShortcutsBackground1</string>
<string>ShortcutsBackground2</string>
</array>
</dict>
</dict>
</dict>

修改磁贴默认色

1
static var shortcutTileColor: ShortcutTileColor = .blue

磁贴色