# hs.dialog.color

A panel that allows users to select a color.

---

## API Overview
**Functions** - _API calls offered directly by the extension_
 * [alpha](#alpha)
 * [callback](#callback)
 * [color](#color)
 * [continuous](#continuous)
 * [hide](#hide)
 * [mode](#mode)
 * [show](#show)
 * [showsAlpha](#showsalpha)

---

## API Documentation

#### Functions

### [alpha](#alpha)

|                                             |                                                                                     |
| --------------------------------------------|-------------------------------------------------------------------------------------|
| **Signature**                               | `hs.dialog.color.alpha([value]) -> number`                                                                    |
| **Type**                                    | Function                                                                     |
| **Description**                             | Set or display the selected opacity.                                                                     |
| **Parameters**                              | <ul><li>[value] - A opacity value as a number between 0 and 1, where 0 is 100% transparent/see-through.</li></ul> |
| **Returns**                                 | <ul><li>The current alpha value as a number.</li></ul>          |
| **Notes**                                   | <ul><li>Example:</li><li>     `hs.dialog.color.alpha(0.5)`</li></ul> |
| **Examples**                                | None |
| **Source**                                  | [extensions/dialog/libdialog.m line 257](https://github.com/CommandPost/CommandPost-App/blob/master/extensions/dialog/libdialog.m#L257) |

---

### [callback](#callback)

|                                             |                                                                                     |
| --------------------------------------------|-------------------------------------------------------------------------------------|
| **Signature**                               | `hs.dialog.color.callback([callbackFn]) -> function or nil`                                                                    |
| **Type**                                    | Function                                                                     |
| **Description**                             | Sets or removes the callback function for the color panel.                                                                     |
| **Parameters**                              | <ul><li>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).</li></ul> |
| **Returns**                                 | <ul><li>The last callbackFn or `nil` so you can save it and re-attach it if something needs to temporarily take the callbacks.</li></ul>          |
| **Notes**                                   | <ul><li>Example:</li><li>     `hs.dialog.color.callback(function(a,b) print("COLOR CALLBACK:\nSelected Color: " .. hs.inspect(a) .. "\nPanel Closed: " .. hs.inspect(b)) end)`</li></ul> |
| **Examples**                                | None |
| **Source**                                  | [extensions/dialog/libdialog.m line 79](https://github.com/CommandPost/CommandPost-App/blob/master/extensions/dialog/libdialog.m#L79) |

---

### [color](#color)

|                                             |                                                                                     |
| --------------------------------------------|-------------------------------------------------------------------------------------|
| **Signature**                               | `hs.dialog.color.color([value]) -> table`                                                                    |
| **Type**                                    | Function                                                                     |
| **Description**                             | Set or display the currently selected color in a color wheel.                                                                     |
| **Parameters**                              | <ul><li>[value] - The color values in a table (as described in `hs.drawing.color`).</li></ul> |
| **Returns**                                 | <ul><li>A table of the currently selected color in the form of `hs.drawing.color`.</li></ul>          |
| **Notes**                                   | <ul><li>Example:</li><li>     `hs.dialog.color.color(hs.drawing.color.blue)`</li></ul> |
| **Examples**                                | None |
| **Source**                                  | [extensions/dialog/libdialog.m line 164](https://github.com/CommandPost/CommandPost-App/blob/master/extensions/dialog/libdialog.m#L164) |

---

### [continuous](#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**                              | <ul><li>[value] - `true` if you want to continuously trigger the callback, otherwise `false`.</li></ul> |
| **Returns**                                 | <ul><li>`true` if continuous is enabled otherwise `false`</li></ul>          |
| **Notes**                                   | <ul><li>Example:</li><li>     `hs.dialog.color.continuous(true)`</li></ul> |
| **Examples**                                | None |
| **Source**                                  | [extensions/dialog/libdialog.m line 116](https://github.com/CommandPost/CommandPost-App/blob/master/extensions/dialog/libdialog.m#L116) |

---

### [hide](#hide)

|                                             |                                                                                     |
| --------------------------------------------|-------------------------------------------------------------------------------------|
| **Signature**                               | `hs.dialog.color.hide() -> none`                                                                    |
| **Type**                                    | Function                                                                     |
| **Description**                             | Hides the Color Panel.                                                                     |
| **Parameters**                              | <ul><li>None</li></ul> |
| **Returns**                                 | <ul><li>None</li></ul>          |
| **Notes**                                   | <ul><li>Example:</li><li>     `hs.dialog.color.hide()`</li></ul> |
| **Examples**                                | None |
| **Source**                                  | [extensions/dialog/libdialog.m line 305](https://github.com/CommandPost/CommandPost-App/blob/master/extensions/dialog/libdialog.m#L305) |

---

### [mode](#mode)

|                                             |                                                                                     |
| --------------------------------------------|-------------------------------------------------------------------------------------|
| **Signature**                               | `hs.dialog.color.mode([value]) -> table`                                                                    |
| **Type**                                    | Function                                                                     |
| **Description**                             | Set or display the currently selected color panel mode.                                                                     |
| **Parameters**                              | <ul><li>[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"</li></ul> |
| **Returns**                                 | <ul><li>The current mode as a string.</li></ul>          |
| **Notes**                                   | <ul><li>Example:</li><li>     `hs.dialog.color.mode("RGB")`</li></ul> |
| **Examples**                                | None |
| **Source**                                  | [extensions/dialog/libdialog.m line 189](https://github.com/CommandPost/CommandPost-App/blob/master/extensions/dialog/libdialog.m#L189) |

---

### [show](#show)

|                                             |                                                                                     |
| --------------------------------------------|-------------------------------------------------------------------------------------|
| **Signature**                               | `hs.dialog.color.show() -> none`                                                                    |
| **Type**                                    | Function                                                                     |
| **Description**                             | Shows the Color Panel.                                                                     |
| **Parameters**                              | <ul><li>None</li></ul> |
| **Returns**                                 | <ul><li>None</li></ul>          |
| **Notes**                                   | <ul><li>Example:</li><li>     `hs.dialog.color.show()`</li></ul> |
| **Examples**                                | None |
| **Source**                                  | [extensions/dialog/libdialog.m line 285](https://github.com/CommandPost/CommandPost-App/blob/master/extensions/dialog/libdialog.m#L285) |

---

### [showsAlpha](#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**                              | <ul><li>[value] - `true` if you want to display an opacity slider, otherwise `false`.</li></ul> |
| **Returns**                                 | <ul><li>`true` if the opacity slider is displayed otherwise `false`</li></ul>          |
| **Notes**                                   | <ul><li>Example:</li><li>     `hs.dialog.color.showsAlpha(true)`</li></ul> |
| **Examples**                                | None |
| **Source**                                  | [extensions/dialog/libdialog.m line 140](https://github.com/CommandPost/CommandPost-App/blob/master/extensions/dialog/libdialog.m#L140) |

---

---

<script src="https://giscus.app/client.js"
        data-repo="CommandPost/CommandPost"
        data-repo-id="MDEwOlJlcG9zaXRvcnk3NDY0NTk2NQ=="
        data-category="Website Discussion"
        data-category-id="DIC_kwDOBHMBzc4CXFFA"
        data-mapping="pathname"
        data-strict="0"
        data-reactions-enabled="1"
        data-emit-metadata="0"
        data-input-position="bottom"
        data-theme="dark"
        data-lang="en"
        crossorigin="anonymous"
        async>
</script>
