systemPreferences
Get system preferences.获取系统首选项。
Process:进程:Main
const { systemPreferences } = require('electron')
console.log(systemPreferences.isDarkMode())
Events事件
The systemPreferences
object emits the following events:systemPreferences
对象会发出以下事件:
Event: 'accent-color-changed' Windows
Returns:返回:
event
EventnewColor
string -The new RGBA color the user assigned to be their system accent color.用户指定为其系统强调色的新RGBA颜色。
Event: 'color-changed' Windows
Returns:返回:
event
Event
Event: 'inverted-color-scheme-changed' Windows Deprecated
Returns:返回:
event
EventinvertedColorScheme
boolean -如果使用倒置的配色方案(具有浅色文本和深色背景的高对比度配色方案),则为true
if an inverted color scheme (a high contrast color scheme with light text and dark backgrounds) is being used,false
otherwise.true
,否则为false
。
Deprecated: Should use the new updated event on the 应该在nativeTheme
module.nativeTheme
模块上使用新updated的事件。
Event: 'high-contrast-color-scheme-changed' Windows Deprecated
Returns:返回:
event
EventhighContrastColorScheme
boolean -如果使用高对比度主题,则为true
if a high contrast theme is being used,false
otherwise.true
,否则为false
。
Deprecated: Should use the new updated event on the 应该在nativeTheme
module.nativeTheme
模块上使用新updated的事件。
Methods方法
systemPreferences.isDarkMode()
macOS Windows Deprecated
Returns返回boolean
- Whether the system is in Dark Mode.系统是否处于黑暗模式。
Deprecated: Should use the new nativeTheme.shouldUseDarkColors API.应该使用新的nativeTheme.shouldUseDarkColors API。
systemPreferences.isSwipeTrackingFromScrollEventsEnabled()
macOS
Returns返回boolean
- Whether the Swipe between pages setting is on.是否启用“在页面之间滑动”设置。
systemPreferences.postNotification(event, userInfo[, deliverImmediately])
macOS
event
stringuserInfo
Record<string, any>deliverImmediately
boolean (optional) -true
to post notifications immediately even when the subscribing app is inactive.true
,即使在订阅应用程序处于非活动状态时也能立即发布通知。
Posts 将event
as native notifications of macOS. event
作为macOS的本地通知发布。The userInfo
is an Object that contains the user information dictionary sent along with the notification.userInfo
是一个Object,它包含与通知一起发送的用户信息字典。
systemPreferences.postLocalNotification(event, userInfo)
macOS
event
stringuserInfo
Record<string, any>
Posts 将event
as native notifications of macOS. event
作为macOS的本地通知发布。The userInfo
is an Object that contains the user information dictionary sent along with the notification.userInfo
是一个Object,它包含与通知一起发送的用户信息字典。
systemPreferences.postWorkspaceNotification(event, userInfo)
macOS
event
stringuserInfo
Record<string, any>
Posts 将event
as native notifications of macOS. event
作为macOS的本地通知发布。The userInfo
is an Object that contains the user information dictionary sent along with the notification.userInfo
是一个Object,它包含与通知一起发送的用户信息字典。
systemPreferences.subscribeNotification(event, callback)
macOS
event
string | nullcallback
Functionevent
stringuserInfo
Record<string, unknown>object
string
Returns返回number
- The ID of this subscription此订阅的ID
Subscribes to native notifications of macOS, 订阅macOS的本地通知,当相应的事件发生时,将以callback
will be called with callback(event, userInfo)
when the corresponding event
happens. callback(event, userInfo)
的形式调用callback
。The userInfo
is an Object that contains the user information dictionary sent along with the notification. userInfo
是一个Object,它包含与通知一起发送的用户信息字典。The 该object
is the sender of the notification, and only supports NSString
values for now.object
是通知的发送方,目前仅支持NSString
值。
The 返回订阅者的id
of the subscriber is returned, which can be used to unsubscribe the event
.id
,该id
可用于取消订阅event
。
Under the hood this API subscribes to 在后台,此API订阅了NSDistributedNotificationCenter
, example values of event
are:NSDistributedNotificationCenter
,event
的示例值为:
AppleInterfaceThemeChangedNotification
AppleAquaColorVariantChanged
AppleColorPreferencesChangedNotification
AppleShowScrollBarsSettingChanged
If 如果event
is null, the NSDistributedNotificationCenter
doesn’t use it as criteria for delivery to the observer. event
为null
,则NSDistributedNotificationCenter
不会将其用作传递给观察者的标准。See docs for more information.有关详细信息,请参阅文档。
systemPreferences.subscribeLocalNotification(event, callback)
macOS
event
string | nullcallback
Functionevent
stringuserInfo
Record<string, unknown>object
string
Returns返回number
- The ID of this subscription此订阅的ID
Same as 与subscribeNotification
, but uses NSNotificationCenter
for local defaults. subscribeNotification
相同,但使用NSNotificationCenter
进行本地默认设置。This is necessary for events such as 这对于NSUserDefaultsDidChangeNotification
.NSUserDefaultsDidChangeNotification
等事件是必要的。
If 如果event
is null, the NSNotificationCenter
doesn’t use it as criteria for delivery to the observer. event
为null
,则NSNotificationCenter
不会将其用作传递给观察者的标准。See docs for more information.有关详细信息,请参阅文档。
systemPreferences.subscribeWorkspaceNotification(event, callback)
macOS
event
string | nullcallback
Functionevent
stringuserInfo
Record<string, unknown>object
string
Returns返回number
- The ID of this subscription此订阅的ID
Same as 与subscribeNotification
, but uses NSWorkspace.sharedWorkspace.notificationCenter
. subscribeNotification
相同,但使用NSWorkspace.sharedWorkspace.notificationCenter
。This is necessary for events such as 这对于NSWorkspaceDidActivateApplicationNotification
.NSWorkspaceDidActivateApplicationNotification
等事件是必要的。
If 如果event
is null, the NSWorkspaceNotificationCenter
doesn’t use it as criteria for delivery to the observer. event
为null
,则NSWorkspaceNotificationCenter
不会将其用作传递给观察者的标准。See docs for more information.有关详细信息,请参阅文档。
systemPreferences.unsubscribeNotification(id)
macOS
id
Integer
Removes the subscriber with 使用id
.id
删除订阅者。
systemPreferences.unsubscribeLocalNotification(id)
macOS
id
Integer
Same as 与unsubscribeNotification
, but removes the subscriber from NSNotificationCenter
.unsubscribeNotification
相同,但从NSNotificationCenter
中删除订阅服务器。
systemPreferences.unsubscribeWorkspaceNotification(id)
macOS
id
Integer
Same as 与unsubscribeNotification
, but removes the subscriber from NSWorkspace.sharedWorkspace.notificationCenter
.unsubscribeNotification
相同,但从NSWorkspace.sharedWorkspace.notificationCenter
中删除订阅服务器。
systemPreferences.registerDefaults(defaults)
macOS
defaults
Record<string, string | boolean | number> -a dictionary of (key: value
) user defaultskey:value
形式的用户默认值的字典
Add the specified defaults to your application's 将指定的默认值添加到应用程序的NSUserDefaults
.NSUserDefaults
中。
systemPreferences.getUserDefault<Type extends keyof UserDefaultTypes>(key, type)
macOS
key
stringtype
Type -Can be可以是string
,boolean
,integer
,float
,double
,url
,array
ordictionary
.string
、boolean
、integer
、float
、double
、url
、array
或dictionary
。
Returns UserDefaultTypes[Type] - The value of key
in NSUserDefaults
.NSUserDefaults
中key
的值。
Some popular 一些流行的key
and type
s are:key
和type
有:
AppleInterfaceStyle
:string
AppleAquaColorVariant
:integer
AppleHighlightColor
:string
AppleShowScrollBars
:string
NSNavRecentPlaces
:array
NSPreferredWebServices
:dictionary
NSUserDictionaryReplacementItems
:array
systemPreferences.setUserDefault<Type extends keyof UserDefaultTypes>(key, type, value)
macOS
key
stringtype
Type -Can be可以是string
,boolean
,integer
,float
,double
,url
,array
ordictionary
.string
、boolean
、integer
、float
、double
、url
、array
或dictionary
。value
UserDefaultTypes[Type]
Set the value of 在key
in NSUserDefaults
.NSUserDefaults
中设置key
的值。
Note that 请注意,type
should match actual type of value
. type
应该与value
的实际类型相匹配。An exception is thrown if they don't.如果没有,则抛出异常。
Some popular key
and type
s are:
ApplePressAndHoldEnabled
:boolean
systemPreferences.removeUserDefault(key)
macOS
key
string
Removes the 删除key
in NSUserDefaults
. NSUserDefaults
中的key
。This can be used to restore the default or global value of a 这可用于恢复以前使用key
previously set with setUserDefault
.setUserDefault
设置的key
的默认值或全局值。
systemPreferences.isAeroGlassEnabled()
Windows
Returns返回boolean
- 如果启用了DWM合成(Aero Glass),则为true
if DWM composition (Aero Glass) is enabled, and false
otherwise.true
,否则为false
。
An example of using it to determine if you should create a transparent window or not (transparent windows won't work correctly when DWM composition is disabled):使用它来确定是否应该创建透明窗口的示例(禁用DWM合成时,透明窗口将无法正常工作):
const { BrowserWindow, systemPreferences } = require('electron')
const browserOptions = { width: 1000, height: 800 }
// Make the window transparent only if the platform supports it.
if (process.platform !== 'win32' || systemPreferences.isAeroGlassEnabled()) {
browserOptions.transparent = true
browserOptions.frame = false
}
// Create the window.
const win = new BrowserWindow(browserOptions)
// Navigate.
if (browserOptions.transparent) {
win.loadURL(`file://${__dirname}/index.html`)
} else {
// No transparency, so we load a fallback that uses basic styles.
win.loadURL(`file://${__dirname}/fallback.html`)
}
systemPreferences.getAccentColor()
Windows macOS
Returns返回string
- The users current system wide accent color preference in RGBA hexadecimal form.用户当前系统范围内RGBA十六进制形式的重音颜色首选项。
const color = systemPreferences.getAccentColor() // `"aabbccdd"`
const red = color.substr(0, 2) // "aa"
const green = color.substr(2, 2) // "bb"
const blue = color.substr(4, 2) // "cc"
const alpha = color.substr(6, 2) // "dd"
This API is only available on macOS 10.14 Mojave or newer.此API仅在macOS 10.14 Mojave或更新版本上可用。
systemPreferences.getColor(color)
Windows macOS
color
string -One of the following values:以下值之一:- On Windows:
3d-dark-shadow
-Dark shadow for three-dimensional display elements.三维显示元素的阴影。3d-face
-Face color for three-dimensional display elements and for dialog box backgrounds.三维显示元素和对话框背景的面颜色。3d-highlight
-Highlight color for three-dimensional display elements.三维显示元素的高亮显示颜色。3d-light
-Light color for three-dimensional display elements.三维显示元素的浅色。3d-shadow
-Shadow color for three-dimensional display elements.三维显示元素的阴影颜色。active-border
-Active window border.活动窗口边框。active-caption
-Active window title bar.活动窗口标题栏。Specifies the left side color in the color gradient of an active window's title bar if the gradient effect is enabled.如果启用渐变效果,则指定活动窗口标题栏的颜色渐变中的左侧颜色。active-caption-gradient
-Right side color in the color gradient of an active window's title bar.活动窗口标题栏的颜色渐变中的右侧颜色。app-workspace
-Background color of multiple document interface (MDI) applications.多文档界面(MDI)应用程序的背景色。button-text
-Text on push buttons.按钮上的文字。caption-text
-Text in caption, size box, and scroll bar arrow box.标题、大小框和滚动条箭头框中的文本。desktop
-Desktop background color.桌面背景颜色。disabled-text
-Grayed (disabled) text.灰色(禁用)文本。highlight
-Item(s) selected in a control.在控件中选择的项。highlight-text
-Text of item(s) selected in a control.控件中所选项目的文本。hotlight
-Color for a hyperlink or hot-tracked item.超链接或热跟踪项目的颜色。inactive-border
-Inactive window border.非活动窗口边框。inactive-caption
-Inactive window caption.非活动窗口标题。Specifies the left side color in the color gradient of an inactive window's title bar if the gradient effect is enabled.如果启用渐变效果,则指定非活动窗口标题栏的颜色渐变中的左侧颜色。inactive-caption-gradient
-Right side color in the color gradient of an inactive window's title bar.非活动窗口标题栏的颜色渐变中的右侧颜色。inactive-caption-text
-Color of text in an inactive caption.非活动标题中文本的颜色。info-background
-Background color for tooltip controls.工具提示控件的背景色。info-text
-Text color for tooltip controls.工具提示控件的文本颜色。menu
-Menu background.菜单背景。menu-highlight
-The color used to highlight menu items when the menu appears as a flat menu.当菜单显示为平面菜单时,用于高亮显示菜单项的颜色。menubar
-The background color for the menu bar when menus appear as flat menus.当菜单显示为平面菜单时,菜单栏的背景色。menu-text
-Text in menus.菜单中的文本。scrollbar
-Scroll bar gray area.滚动条灰色区域。window
-Window background.窗口背景。window-frame
-Window frame.窗框。window-text
-Text in windows.窗口中的文本。
- On macOS
alternate-selected-control-text
-The text on a selected surface in a list or table.列表或表格中选定曲面上的文本。deprecatedcontrol-background
-The background of a large interface element, such as a browser or table.大型界面元素(如浏览器或表格)的背景。control
-The surface of a control.控件的表面。control-text
-The text of a control that isn’t disabled.未被禁用的控件的文本。disabled-control-text
-The text of a control that’s disabled.被禁用的控件的文本。find-highlight
-The color of a find indicator.查找指示器的颜色。grid
-The gridlines of an interface element such as a table.界面元素(如表)的网格线。header-text
-The text of a header cell in a table.表中标题单元格的文本。highlight
-The virtual light source onscreen.屏幕上的虚拟光源。keyboard-focus-indicator
-The ring that appears around the currently focused control when using the keyboard for interface navigation.使用键盘进行界面导航时,出现在当前聚焦控件周围的环。label
-The text of a label containing primary content.包含主要内容的标签的文本。link
-A link to other content.指向其他内容的链接。placeholder-text
-A placeholder string in a control or text view.控件或文本视图中的占位符字符串。quaternary-label
-The text of a label of lesser importance than a tertiary label such as watermark text.与第三级标签(如水印文本)相比,重要性较低的标签的文本。scrubber-textured-background
-The background of a scrubber in the Touch Bar.触摸条中洗涤器的背景。secondary-label
-The text of a label of lesser importance than a normal label such as a label used to represent a subheading or additional information.重要性低于普通标签的标签文本,例如用于表示副标题或附加信息的标签。selected-content-background
-The background for selected content in a key window or view.关键窗口或视图中所选内容的背景。selected-control
-The surface of a selected control.选定控件的曲面。selected-control-text
-The text of a selected control.所选控件的文本。selected-menu-item-text
-The text of a selected menu.所选菜单的文本。selected-text-background
-The background of selected text.所选文本的背景。selected-text
-Selected text.所选文本。separator
-A separator between different sections of content.内容不同部分之间的分隔符。shadow
-The virtual shadow cast by a raised object onscreen.屏幕上凸起的物体投射的虚拟阴影。tertiary-label
-The text of a label of lesser importance than a secondary label such as a label used to represent disabled text.重要性低于次要标签的标签文本,例如用于表示禁用文本的标签。text-background
-Text background.文本背景。text
-The text in a document.文档中的文本。under-page-background
-The background behind a document's content.文档内容背后的背景。unemphasized-selected-content-background
-The selected content in a non-key window or view.在非关键窗口或视图中选择的内容。unemphasized-selected-text-background
-A background for selected text in a non-key window or view.非关键窗口或视图中所选文本的背景。unemphasized-selected-text
-Selected text in a non-key window or view.在非关键窗口或视图中选择的文本。window-background
-The background of a window.窗口的背景。window-frame-text
-The text in the window's titlebar area.窗口标题栏区域中的文本。
- On Windows:
Returns返回string
- The system color setting in RGB hexadecimal form (RGB十六进制形式的系统颜色设置(#ABCDEF
). #ABCDEF
)。See the Windows docs and the macOS docs for more details.有关更多详细信息,请参阅Windows文档和macOS文档。
The following colors are only available on macOS 10.14: 以下颜色仅在macOS 10.14上可用:find-highlight
, selected-content-background
, separator
, unemphasized-selected-content-background
, unemphasized-selected-text-background
, and unemphasized-selected-text
.find-highlight
、selected-content-background
、separator
、unemphasized-selected-content-background
、unemphasized-selected-text-background
和unemphasized-selected-text
。
systemPreferences.getSystemColor(color)
macOS
color
string -One of the following values:以下值之一:blue
brown
gray
green
orange
pink
purple
red
yellow
Returns返回string
- The standard system color formatted as 标准系统颜色,格式为#RRGGBBAA
.#RRGGBBAA
。
Returns one of several standard system colors that automatically adapt to vibrancy and changes in accessibility settings like 'Increase contrast' and 'Reduce transparency'. 返回几种标准系统颜色中的一种,这些颜色会自动适应活力和辅助功能设置的变化,如“增加对比度”和“降低透明度”。See Apple Documentation for more details.有关更多详细信息,请参阅Apple文档。
systemPreferences.isInvertedColorScheme()
Windows Deprecated
Returns返回boolean
- 如果反转配色方案(具有浅色文本和深色背景的高对比度配色方案)处于活动状态,则为true
if an inverted color scheme (a high contrast color scheme with light text and dark backgrounds) is active, false
otherwise.true
,否则为false
。
Deprecated: Should use the new nativeTheme.shouldUseInvertedColorScheme API.应该使用新的nativeTheme.shouldUseInvertedColorScheme API。
systemPreferences.isHighContrastColorScheme()
macOS Windows Deprecated
Returns返回boolean
- 如果高对比度主题处于活动状态,则为true
if a high contrast theme is active, false
otherwise.true
,否则为false
。
Deprecated: Should use the new nativeTheme.shouldUseHighContrastColors API.应该使用新的nativeTheme.shouldUseHighContrastColors API。
systemPreferences.getEffectiveAppearance()
macOS
Returns返回string
- Can be 可以是dark
, light
or unknown
.dark
、light
或ruknown
。
Gets the macOS appearance setting that is currently applied to your application, maps to NSApplication.effectiveAppearance获取当前应用于应用程序的macOS外观设置,映射到NSApplication.effectiveAppearance
systemPreferences.getAppLevelAppearance()
macOS Deprecated
Returns返回string
| null
- Can be 可以是dark
, light
or unknown
.dark
、light
或known
Gets the macOS appearance setting that you have declared you want for your application, maps to NSApplication.appearance. 获取您为应用程序声明的macOS外观设置,映射到NSApplication.appearance。You can use the 您可以使用setAppLevelAppearance
API to set this value.setAppLevelAppearance
API来设置此值。
systemPreferences.setAppLevelAppearance(appearance)
macOS Deprecated
appearance
string | null -Can be可以是dark
orlight
dark
或light
Sets the appearance setting for your application, this should override the system default and override the value of 设置应用程序的外观设置,这将覆盖系统默认值并覆盖getEffectiveAppearance
.getEffectiveAppearance
的值。
systemPreferences.canPromptTouchID()
macOS
Returns返回boolean
- whether or not this device has the ability to use Touch ID.该设备是否具有使用Touch ID的能力。
NOTE: This API will return 在Sierra 10.12.2之前的macOS系统上,此API将返回false
on macOS systems older than Sierra 10.12.2.false
。
systemPreferences.promptTouchID(reason)
macOS
reason
string -The reason you are asking for Touch ID authentication您要求Touch ID身份验证的原因
Returns返回Promise<void>
- resolves if the user has successfully authenticated with Touch ID.解决用户是否已成功使用Touch ID进行身份验证。
const { systemPreferences } = require('electron')
systemPreferences.promptTouchID('To get consent for a Security-Gated Thing').then(success => {
console.log('You have successfully authenticated with Touch ID!')
}).catch(err => {
console.log(err)
})
This API itself will not protect your user data; rather, it is a mechanism to allow you to do so. 此API本身不会保护您的用户数据;相反,它是一种允许你这样做的机制。Native apps will need to set Access Control Constants like kSecAccessControlUserPresence on their keychain entry so that reading it would auto-prompt for Touch ID biometric consent. 本地应用程序需要在其钥匙链条目上设置访问控制常量,如kSecAccessControlUserPresence,以便读取该常量时会自动提示Touch ID生物识别同意。This could be done with node-keytar, such that one would store an encryption key with 这可以通过node-keytar来完成,这样就可以使用node-keytar
and only fetch it if promptTouchID()
resolves.node-keytar
存储加密密钥,并且只有在promptTouchID()
解析时才能获取它。
NOTE: This API will return a rejected Promise on macOS systems older than Sierra 10.12.2.此API将在早于Sierra 10.12.2的macOS系统上返回被拒绝的Promise。
systemPreferences.isTrustedAccessibilityClient(prompt)
macOS
prompt
boolean -whether or not the user will be informed via prompt if the current process is untrusted.如果当前进程不可信,则是否将通过提示通知用户。
Returns返回boolean
- 如果当前进程是受信任的可访问性客户端,则为true
if the current process is a trusted accessibility client and false
if it is not.true
;如果不是,则为false
。
systemPreferences.getMediaAccessStatus(mediaType)
Windows macOS
mediaType
string -Can be可以是microphone
,camera
orscreen
.microphone
、camera
或screen
Returns返回string
- Can be 可以是not-determined
, granted
, denied
, restricted
or unknown
.not-determined
、granted
、denied
、restricted
或unknown
。
This user consent was not required on macOS 10.13 High Sierra or lower so this method will always return 在macOS 10.13 High Sierra或更低版本上不需要此用户同意,因此此方法将始终返回granted
. granted
。macOS 10.14 Mojave or higher requires consent for macOS 10.14 Mojave或更高版本需要获得microphone
and camera
access. microphone
和camera
访问许可。macOS 10.15 Catalina or higher requires consent for macOS 10.15 Catalina或更高版本需要获得同意才能访问screen
access.screen
。
Windows 10 has a global setting controlling Windows 10具有全局设置,用于控制所有win32应用程序的microphone
and camera
access for all win32 applications. microphone
和camera
访问。It will always return 对于granted
for screen
and for all media types on older versions of Windows.screen
和旧版本的Windows上的所有媒体类型,它将始终返回granted
。
systemPreferences.askForMediaAccess(mediaType)
macOS
mediaType
string -the type of media being requested; can be所请求的媒体类型;可以是microphone
,camera
.microphone
、camera
。
Returns返回Promise<boolean>
- A promise that resolves with 一种承诺,如果同意,则为true
if consent was granted and false
if it was denied. true
,如果拒绝,则为false
。If an invalid 如果传递了无效的mediaType,则promise将被拒绝。mediaType
is passed, the promise will be rejected. If an access request was denied and later is changed through the System Preferences pane, a restart of the app will be required for the new permissions to take effect. 如果访问请求被拒绝,并且稍后通过“系统首选项”窗格进行更改,则需要重新启动应用程序才能使新权限生效。If access has already been requested and denied, it must be changed through the preference pane; an alert will not pop up and the promise will resolve with the existing access status.如果已经请求并拒绝访问,则必须通过首选项窗格进行更改;不会弹出警报,并且承诺将以现有访问状态解决。
Important: In order to properly leverage this API, you must set the 为了正确利用此API,您必须在应用程序的NSMicrophoneUsageDescription
and NSCameraUsageDescription
strings in your app's Info.plist
file. Info.plist
文件中设置NSMicrophoneUsageDescription
和NSCameraUsageDescription
字符串。The values for these keys will be used to populate the permission dialogs so that the user will be properly informed as to the purpose of the permission request. 这些密钥的值将用于填充权限对话框,以便正确地通知用户权限请求的目的。See Electron Application Distribution for more information about how to set these in the context of Electron.有关如何在Electron上下文中设置这些应用程序的更多信息,请参阅Electron应用程序分布。
This user consent was not required until macOS 10.14 Mojave, so this method will always return 直到macOS 10.14 Mojave才需要此用户同意,因此如果您的系统运行10.13 High Sierra或更低版本,此方法将始终返回true
if your system is running 10.13 High Sierra or lower.true
。
systemPreferences.getAnimationSettings()
Returns返回Object
:
shouldRenderRichAnimation
boolean -Returns true if rich animations should be rendered.如果应该渲染丰富的动画,则返回true
。Looks at session type (e.g. remote desktop) and accessibility settings to give guidance for heavy animations.查看会话类型(例如远程桌面)和辅助功能设置,为重动画提供指导。scrollAnimationsEnabledBySystem
boolean -Determines on a per-platform basis whether scroll animations (e.g. produced by home/end key) should be enabled.根据每个平台确定是否应启用滚动动画(例如,由主页/结束键生成)。prefersReducedMotion
boolean -Determines whether the user desires reduced motion based on platform APIs.确定用户是否希望基于平台API减少运动。
Returns an object with system animation settings.返回具有系统动画设置的对象。
Properties属性
systemPreferences.appLevelAppearance
macOS
A string
property that can be dark
, light
or unknown
. string
属性,可以是dark
、light
或known
。It determines the macOS appearance setting for your application. 它决定了应用程序的macOS外观设置。This maps to values in: NSApplication.appearance. 这将映射到:NSApplication.appearance中的值。Setting this will override the system default as well as the value of 设置此项将覆盖系统默认值以及getEffectiveAppearance
.getEffectiveAppearance
的值。
Possible values that can be set are 可以设置的可能值为dark
and light
, and possible return values are dark
, light
, and unknown
.dark
和light
,可能的返回值为dark
、light
和known
。
This property is only available on macOS 10.14 Mojave or newer.此属性仅在macOS 10.14 Mojave或更新版本上可用。
systemPreferences.effectiveAppearance
macOS Readonly
A string
property that can be dark
, light
or unknown
.string
属性,可以是dark
、light
或known
。
Returns the macOS appearance setting that is currently applied to your application, maps to 返回当前应用于应用程序的macOS外观设置,映射到NSApplication.effectiveAppearance