跳到主内容

类: TouchBarLabel

类: TouchBarLabel

在原生macOS应用程序的触摸栏中创建一个标签

Process: Main
此类不从 'electron' 模块导出. 它只能作为Electron API中其他方法的返回值。

new TouchBarLabel(options)

  • 选项 对象
    • label String (可选) - 显示的文本.
    • accessibilityLabel String (optional) - A short description of the button for use by screenreaders like VoiceOver.
    • textColor String(可选) - 文本的十六进制颜色,例如#ABCDEF。

When defining accessibilityLabel, ensure you have considered macOS best practices.

实例属性

以下属性可用于 TouchBarLabel:

touchBarLabel.label

A String representing the label's current text. Changing this value immediately updates the label in the touch bar.

touchBarLabel.accessibilityLabel

A String representing the description of the label to be read by a screen reader.

touchBarLabel.textColor

A String hex code representing the label's current text color. Changing this value immediately updates the label in the touch bar.