Skip to main content

类:TouchBarColorPicker

类:TouchBarColorPicker

🌐 Class: TouchBarColorPicker

为本地 macOS 应用在触控栏创建一个颜色选择器

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

new TouchBarColorPicker(options)

  • options 对象
    • availableColors string[](可选)- 作为可选择颜色的十六进制颜色字符串数组。
    • selectedColor 字符串(可选)- 选择器中选定的十六进制颜色,例如 #ABCDEF
    • change 函数(可选)- 选择颜色时调用的函数。
      • color 字符串 - 用户从选择器中选取的颜色。

实例属性

🌐 Instance Properties

TouchBarColorPicker 实例上可用的属性如下:

🌐 The following properties are available on instances of TouchBarColorPicker:

touchBarColorPicker.availableColors

一个 string[] 数组,表示颜色选择器可供选择的颜色。更改此值会立即更新触控栏中的颜色选择器。

🌐 A string[] array representing the color picker's available colors to select. Changing this value immediately updates the color picker in the touch bar.

touchBarColorPicker.selectedColor

一个 string 十六进制代码,表示颜色选择器当前选中的颜色。更改此值会立即更新触控栏中的颜色选择器。

🌐 A string hex code representing the color picker's currently selected color. Changing this value immediately updates the color picker in the touch bar.