跳转到主要内容

类:TouchBarLabel

类:TouchBarLabel

为原生 macOS 应用程序创建触摸栏中的标签。

进程:主进程
此类未从 'electron' 模块导出。它仅作为 Electron API 中其他方法的返回值可用。

new TouchBarLabel(options)

  • options Object
    • label 字符串 (可选) - 要显示的文本。
    • accessibilityLabel 字符串 (可选) - 按钮的简短描述,供 VoiceOver 等屏幕阅读器使用。
    • textColor 字符串 (可选) - 文本的十六进制颜色,例如 #ABCDEF

在定义 accessibilityLabel 时,请确保已考虑 macOS 最佳实践

实例属性

TouchBarLabel 实例上有以下可用属性:

touchBarLabel.label

表示标签当前文本的 string。更改此值会立即更新触摸栏中的标签。

touchBarLabel.accessibilityLabel

表示屏幕阅读器将读取的标签描述的 string

touchBarLabel.textColor

表示标签当前文本颜色的十六进制代码 string。更改此值会立即更新触摸栏中的标签。