Hen*_*rik 3 macos user-interface colors custom-controls
MacOS 10.14(Mojave)具有Dark界面风格和用户可选择的颜色重音.如何阅读这些值并听取更改?
它存储在系统默认值中,可通过NSDistributedNotificationCenter.
当黑暗模式处于活动状态AppleInterfaceStyle设置为Dark.通过收听InterfaceStyleChanged通知可以观察到变化.
可以从中读取强调色AppleAccentColor.通过收听AppleColorPreferencesChangedNotification通知可以观察到变化.两者都返回一个可选的整数,映射到:
nil: blue
-1: graphite
0: red
1: orange
2: yellow
3: green
5: purple
6: pink
Run Code Online (Sandbox Code Playgroud)