Come build with us.
Stacks API v13 for Stacks 5.0
color
allowsOpacity
prefix
default
id
title
enable
toolTip
subtitles
scope
inheritsFrom
color
color
color-2, color-3, color-4
HTML Color String
A color well.
When clicked the RapidWeaver shared color pallet is displayed. The selected color is converted to RGB and returned as a hex string or rgba color value.
The color control now allows you to enable opacity when selecting colors. To ensure backward compatability it defaults to being disabled.
Colors that include an opacity will be output (in templates) as rgba color values. Colors without an opacity will be output as HTML hex colors.
Default values can be supplied for color controls useing HTML hex values, rgb values, or rgba values. Rgb and rgba color components can use 0-255 (rgb values equivalent to the HTML hex value) or percentages 0%
- 100%
. The opacity component in rgba can use either percentages 0%
- 100%
or decimal notation 0.0
- 1.0
An HTML hex color for red:
#FF0000
An rgb color for green:
rgb(0, 255, 0)
An rgba color for translucent blue:
rgba(0, 0, 50%, 0.5)
Color controls can be used in arrays. Each has its own subtitle and default, all other values are shared.
NB: color-3 requires Stacks API v8 (Stacks v3.1+), 2 & 4 require v7 (Stacks v3.0+), single control requires v1.
Color array types are:
color
: a regular color control.color-2
: two color controls.color-3
: three color controls.color-4
: four color controls.In arrayed color controls default values for the default
key can either be a single color (applied to all controls in the array) or an array of colors.
allowsOpacity
boolean
prefix
string
The default prefix for the returned string is #, this means that if no prefix is specified then the returned color string will be a standard HTML RGB Hex string (e.g. #1F2F3F
).
For some applications such as Flash the raw hex value is needed without the hash character prefix. Setting the prefix to the empty-string ""
will return the six character hex value without any prefix (a format commonly used in Flash).
default
HTML Color String
Light gray: #ccc
id
string
The ID for this control. This ID must be unique within this stack. The ID is used to refer to control’s property. IDs should be alpha-numeric (dashes and underscores are allowed), but should not contain special characters.
title
string
"Untitled"
The title displayed next to the control. Long titles will be truncated, so keep it short.
enable
dictionary
enabled
Hide or show the control based on the value of another property.
Enables allow a stack to show only the controls needed by the user to achieve a specific task.
The enable dictionary defines the ID of another control and the value that other control must equal. When the other control’s value is not equal to the provided value, this control is hidden.
id
(string) — the ID of another control on which this control (Popup Menu) should depend.value
(any type) — when the value of the other control is equal to this value, this control is displayed, otherwise it is hidden.index
(number) - for arrayed controls you’ll need to specify the index of the array id.round
(boolean) - whether or not to round numeric control values. the default is YES. you must set this value to NO to disable – even if the property that’s being matched has rounding enabled.operation
(string) - can be any of the following: ==
, <
, <=
, >
, >=
, contains
, matches
, or caseInsensitiveMatches
.==
- (any type) - default compares any two values. to maintain backwards compatibility rounding is never applied. (aliases: =
, equals
, equalTo
)<
- (number) - less than. (aliases: lessThan
)<=
- (number) - less than or equal to. (aliases: lessThanOrEqualTo
, lessThanOrEquals
)>
- (number) - greater than. (aliases: greaterThan
)>=
- (number) - greater than or equal to. (aliases: greaterThanOrEqualTo
, greaterThanOrEquals
)contains
- (string) - This does a case insensitive match of the value anywhere in the string.matches
- (string) - Wildcard match. Examples: Red
(matches: Red
and Reddish
), R?d
(matches: Red
and Rad
)caseInsensitiveMatches
- (string) - Similar to matches
but ignores case.Warning: creating infinite loops in enable dependencies has undefined behavior. It will likely result in a RapidWeaver crash.
NB: macOS does not specify the wildcard characters available or how they function.
*
and?
clearly work as they do in a UNIX shell. you’ll just have to guess at the rest.
toolTip
string
No tooltip is displayed.
The tooltip value is used to display hints for the user on the use of each control. If the function of the control is obvious, then a tooltip should be avoided. Simply re-displaying redundant information like the title has no value to the user.
subtitles
array of strings
No subtitles are displayed.
Subtitles are displayed under the control. Subtitles are unique for each item in a control array. You should provide one for each item in the control array. In the plist the subtitles should be an array of Subtitle strings. Note that some controls have very little space, so only very short subtitles can be used.
scope
string
"each"
The scope of a property can be set to bind to the page instead of each stack. Binding a property to the page-scope means that the values set by this control will be shared between all stack-instances on the page.
inheritsFrom
string
No inheritance.
Inheritance allows one stack to pull in the controls and properties of another stack. All of the controls from the specified stack are pulled in to the current stack. The inherited controls will be ordered as if they were they were first in the plist customItems array. The value should be the ID of the stack to inherit from.