Skip to main content

类:TouchBarColorPicker

类:TouchBarColorPicker

¥Class: TouchBarColorPicker

在触摸栏中为原生 macOS 应用创建颜色选择器

¥Create a color picker in the touch bar for native macOS applications

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

¥Process: Main
This class is not exported from the 'electron' module. It is only available as a return value of other methods in the Electron API.

new TouchBarColorPicker(options)

  • options 对象

    ¥options Object

    • availableColors 字符串[](可选) - 十六进制颜色字符串数组,显示为可供选择的可能颜色。

      ¥availableColors string[] (optional) - Array of hex color strings to appear as possible colors to select.

    • selectedColor 字符串(可选) - 在选择器中选择的十六进制颜色,即 #ABCDEF

      ¥selectedColor string (optional) - The selected hex color in the picker, i.e #ABCDEF.

    • change 功能(可选) - 选择颜色时调用的函数。

      ¥change Function (optional) - Function to call when a color is selected.

      • color 字符串 - 用户从选择器中选择的颜色。

        ¥color string - The color that the user selected from the picker.

实例属性

¥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.