如何确定macOS 10.14的配色? [英] How can I determine the macOS 10.14 accent color?

查看:119
本文介绍了如何确定macOS 10.14的配色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MacOS 10.14(Mojave)具有深色的界面样式和用户可选的颜色强调.如何读取这些值并听取更改?

MacOS 10.14 (Mojave) features a Dark interface style, and user selectable color accents. How to read these values and listen for changes?

推荐答案

此内容存储在系统默认值中,可通过NSDistributedNotificationCenter访问.

This is stored in the system defaults, available through NSDistributedNotificationCenter.

暗模式有效.可以通过监听InterfaceStyleChanged通知来观察更改.

Dark mode is active when AppleInterfaceStyle is set to Dark. Changes can be observed by listening for the InterfaceStyleChanged notification.

可以从AppleAccentColor中读取强调色.可以通过监听AppleColorPreferencesChangedNotification通知来观察更改.两者都返回一个可选的整数,该整数映射到:

The accent color can be read from AppleAccentColor. Changes can be observed by listening for the AppleColorPreferencesChangedNotification notification. Both returns an optional integer, that maps to:

nil: blue
-1: graphite
0: red
1: orange
2: yellow
3: green
5: purple
6: pink

您可以通过运行defaults read -g AppleAccentColor从终端或脚本中读取此值.请注意,如果该值为nil(默认为蓝色),则实际上会显示一条错误消息,该错误显示为The domain/default pair of (kCFPreferencesAnyApplication, AppleAccentColor) does not exist.

You can read this value from the terminal or a script by running defaults read -g AppleAccentColor. Note that if the value is nil (default blue) you actually get an error that reads The domain/default pair of (kCFPreferencesAnyApplication, AppleAccentColor) does not exist.

针对macOS 11 Beta的更新

nil现在是默认的 multicolor 外观,并且 blue 已移至4.

nil is now the default multicolor appearance, and blue has been moved to 4.

nil: multicolor
-1: graphite
0: red
1: orange
2: yellow
3: green
4: blue
5: purple
6: pink

这篇关于如何确定macOS 10.14的配色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆