Skip to content

Commit 90951c3

Browse files
committed
[[ Bug 15850 ]] Document color swatch widget
1 parent ba4c3d2 commit 90951c3

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

extensions/widgets/colorswatch/colorswatch.lcb

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ for more details.
1515
You should have received a copy of the GNU General Public License
1616
along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
1717

18+
/*
19+
This widget displays a color with optional alpha channel.
20+
*/
1821
widget com.livecode.widget.colorSwatch
1922
--
2023

@@ -33,6 +36,43 @@ metadata svgicon is "M86.6,0H7.9C3.5,0,0,3.5,0,7.9v78.8c0,4.3,3.5,7.9,7.9,7.9h78
3336
--
3437

3538
-- property declarations
39+
40+
/*
41+
Syntax:
42+
set the swatchColor of <widget> to <pColor>
43+
get the swatchColor of <widget>
44+
45+
Summary: Determines the color displayed by the swatch.
46+
47+
Parameters:
48+
pColor: The color of the swatch in RGB or RGBA format, or empty.
49+
50+
Example: set the swatchColor of widget "Color Swatch" to empty
51+
52+
Example:
53+
on copySwatchColorToGraphic pSwatchName, pGraphicName
54+
local tColorWithAlpha
55+
put the swatchColor of widget pSwatchName into tColorWithAlpha
56+
57+
local tColor, tBlendLevel
58+
put item 1 to 3 of tColorWithAlpha into tColor
59+
put (255 - item 4 of tColorWithAlpha) / 2.55 into tBlendLevel
60+
61+
set the backcolor of graphic pGraphicName to tColor
62+
set the blendLevel of graphic pGraphicName to tBlendLevel
63+
end copySwatchColorToGraphic
64+
65+
66+
Description:
67+
Use the iconColor property to set the color of the widget icon. The color is
68+
in the form of a 3 or 4 item string, the 4th optional item being the alpha value,
69+
all between 0 and 255.
70+
71+
>*Note:* The color returned by the <swatchColor> property, if not empty,
72+
always includes an alpha value which is 255 by default.
73+
74+
*/
75+
3676
property swatchColor get getColor set setColor
3777
metadata swatchColor.editor is "com.livecode.pi.colorwithalpha"
3878
metadata swatchColor.default is "255,100,0"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# [15850] swatchColor property not documented

0 commit comments

Comments
 (0)