Provides access to the system color lists and a wider variety of ways to represent color within Hammerspoon.
Color is represented within Hammerspoon as a table containing keys which tell Hammerspoon how the color is specified. You can specify a color in one of the following ways, depending upon the keys you supply within the table:
As a combination of Red, Green, and Blue elements (RGB Color):
As a combination of Hue, Saturation, and Brightness (HSB or HSV Color):
As grayscale (Grayscale Color):
From the system or Hammerspoon color lists:
hs.drawing.color
As an HTML style hex color specification:
r
, g
, and b
are hexadecimal digits (i.e. 0-9, A-F)From an image to be used as a tiled pattern:
hs.image
object representing the image to be used as a tiled patternAny combination of the above keys may be specified within the color table and they will be evaluated in the following order:
image
key is specified, it will be used to create a tiling pattern.list
and name
keys are specified, and if they can be matched to an existing color within the system color lists, that color is used.hue
key is provided, then the color is generated as an HSB colorwhite
key is provided, then the color is generated as a Grayscale colorExcept where specified above to indicate the color model being used, any key which is not provided defaults to a value of 0.0, except for alpha
, which defaults to 1.0. This means that specifying an empty table as the color will result in an opaque black color.
Signature | hs.drawing.color.definedCollections |
---|---|
Type | Constant |
Description | This table contains this list of defined color collections provided by the |
Notes |
|
Source | extensions/drawing/color/drawing_color.lua line 361 |
Signature | hs.drawing.color.ansiTerminalColors |
---|---|
Type | Variable |
Description | A collection of colors representing the ANSI Terminal color sequences. The color definitions are based upon code found at https://github.com/balthamos/geektool-3 in the /NerdTool/classes/ANSIEscapeHelper.m file. |
Notes |
|
Source | extensions/drawing/color/drawing_color.lua line 129 |
Signature | hs.drawing.color.hammerspoon |
---|---|
Type | Variable |
Description | This table contains a collection of various useful pre-defined colors: |
Notes |
|
Source | extensions/drawing/color/drawing_color.lua line 330 |
Signature | hs.drawing.color.x11 |
---|---|
Type | Variable |
Description | A collection of colors representing the X11 color names as defined at https://en.wikipedia.org/wiki/Web_colors#X11_color_names (names in lowercase) |
Notes |
|
Source | extensions/drawing/color/drawing_color.lua line 170 |
Signature | hs.drawing.color.asHSB(color) -> table | string |
---|---|
Type | Function |
Description | Returns a table containing the HSB representation of the specified color. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/color/libdrawing_color.m line 66 |
Signature | hs.drawing.color.asRGB(color) -> table | string |
---|---|
Type | Function |
Description | Returns a table containing the RGB representation of the specified color. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/color/libdrawing_color.m line 34 |
Signature | hs.drawing.color.colorsFor(list) -> table |
---|---|
Type | Function |
Description | Returns a table containing the colors for the specified system color list or hs.drawing.color collection. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/color/drawing_color.lua line 100 |
Signature | hs.drawing.color.lists() -> table |
---|---|
Type | Function |
Description | Returns a table containing the system color lists and hs.drawing.color collections with their defined colors. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/color/libdrawing_color.m line 8 |