docs » hs.dialog.color

A panel that allows users to select a color.

API Overview

API Documentation

Functions

alpha
Signature hs.dialog.color.alpha([value]) -> number
Type Function
Description

Set or display the selected opacity.

Parameters
  • [value] - A opacity value as a number between 0 and 1, where 0 is 100% transparent/see-through.
Returns
  • The current alpha value as a number.
Notes
  • Example: hs.dialog.color.alpha(0.5)
Source extensions/dialog/libdialog.m line 257
callback
Signature hs.dialog.color.callback([callbackFn]) -> function or nil
Type Function
Description

Sets or removes the callback function for the color panel.

Parameters
  • a function, or nil to remove the current function, which will be invoked as a callback for messages generated by this color panel. The callback function should expect 2 arguments as follows: ** A table containing the color values from the color panel. ** A boolean which returns true if the color panel has been closed otherwise false indicating that the color panel is still open (i.e. it may change color again).
Returns
  • The last callbackFn or nil so you can save it and re-attach it if something needs to temporarily take the callbacks.
Notes
  • Example: hs.dialog.color.callback(function(a,b) print("COLOR CALLBACK:\nSelected Color: " .. hs.inspect(a) .. "\nPanel Closed: " .. hs.inspect(b)) end)
Source extensions/dialog/libdialog.m line 79
color
Signature hs.dialog.color.color([value]) -> table
Type Function
Description

Set or display the currently selected color in a color wheel.

Parameters
  • [value] - The color values in a table (as described in hs.drawing.color).
Returns
  • A table of the currently selected color in the form of hs.drawing.color.
Notes
  • Example: hs.dialog.color.color(hs.drawing.color.blue)
Source extensions/dialog/libdialog.m line 164
continuous
Signature hs.dialog.color.continuous([value]) -> boolean
Type Function
Description

Set or display whether or not the callback should be continuously updated when a user drags a color slider or control.

Parameters
  • [value] - true if you want to continuously trigger the callback, otherwise false.
Returns
  • true if continuous is enabled otherwise false
Notes
  • Example: hs.dialog.color.continuous(true)
Source extensions/dialog/libdialog.m line 116
hide
Signature hs.dialog.color.hide() -> none
Type Function
Description

Hides the Color Panel.

Parameters
  • None
Returns
  • None
Notes
  • Example: hs.dialog.color.hide()
Source extensions/dialog/libdialog.m line 305
mode
Signature hs.dialog.color.mode([value]) -> table
Type Function
Description

Set or display the currently selected color panel mode.

Parameters
  • [value] - The mode you wish to use as a string from the following options: ** "wheel" - Color Wheel ** "gray" - Gray Scale Slider ** "RGB" - RGB Sliders ** "CMYK" - CMYK Sliders ** "HSB" - HSB Sliders ** "list" - Color Palettes ** "custom" - Image Palettes ** "crayon" - Pencils ** "none"
Returns
  • The current mode as a string.
Notes
  • Example: hs.dialog.color.mode("RGB")
Source extensions/dialog/libdialog.m line 189
show
Signature hs.dialog.color.show() -> none
Type Function
Description

Shows the Color Panel.

Parameters
  • None
Returns
  • None
Notes
  • Example: hs.dialog.color.show()
Source extensions/dialog/libdialog.m line 285
showsAlpha
Signature hs.dialog.color.showsAlpha([value]) -> boolean
Type Function
Description

Set or display whether or not the color panel should display an opacity slider.

Parameters
  • [value] - true if you want to display an opacity slider, otherwise false.
Returns
  • true if the opacity slider is displayed otherwise false
Notes
  • Example: hs.dialog.color.showsAlpha(true)
Source extensions/dialog/libdialog.m line 140