-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathTestColorPalette.jsx
More file actions
123 lines (110 loc) · 2.97 KB
/
Copy pathTestColorPalette.jsx
File metadata and controls
123 lines (110 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#include '../../$$.jsxinc'
#include '../../etc/$$.ScriptUI.jsxinc'
#include '../../etc/ScriptUI/factories/$$.ColorPalette.jsxinc'
$$.load(0);
// =============================================================================
// TestColorPalette [240509]
// ColorPaletteFactory tester.
// =============================================================================
try
{
const BTN_API =
{
setColor: function setColor(rgb){ this.text=this.__rgb__=rgb; ScriptUI.colorSetter(this.parent,rgb.slice(1)); },
getColor: function getColor(){ return this.__rgb__ },
onClick: function onClick(){ this.window.MyPalette.showPalette(this) },
};
ScriptUI.builder
({
properties: { type:'dialog', text:"Test ColorPaletteFactory" },
margins: 0,
spacing: 0,
orientation: 'stack', // IMPORTANT
Group$0:
{
margins: 20,
spacing: 20,
orientation: 'column',
Group$0:
{
orientation: 'column',
alignChildren: ScriptUI.LC,
margins: 5,
spacing: 10,
StaticText$1:
{
properties: { text: "Click the buttons to change background colors:" },
},
Group$1:
{
orientation: 'row',
alignChildren: ScriptUI.LC,
margins: [5,5,100,5],
spacing: 0,
background: 'FF6600',
Button$:
{
properties: { text: "Click" },
__rgb__: '#FF6600',
setColor: BTN_API.setColor,
getColor: BTN_API.getColor,
onClick: BTN_API.onClick,
},
},
Group$2:
{
orientation: 'row',
alignChildren: ScriptUI.LC,
margins: [5,5,100,5],
spacing: 0,
background: 'FF9999',
Button$:
{
properties: { text: "Click" },
__rgb__: '#FF9999',
setColor: BTN_API.setColor,
getColor: BTN_API.getColor,
onClick: BTN_API.onClick,
},
},
Group$3:
{
orientation: 'row',
alignChildren: ScriptUI.LC,
margins: [5,5,100,5],
spacing: 0,
background: '336699',
Button$:
{
properties: { text: "Click" },
__rgb__: '#336699',
setColor: BTN_API.setColor,
getColor: BTN_API.getColor,
onClick: BTN_API.onClick,
},
}
},
Group$1:
{
optimalSize: [320,40],
margins: 20,
orientation: 'row',
alignChildren: ScriptUI.CC,
Button$OK: { properties: { text: __("OK"), name: 'ok'} },
Button$KO: { properties: { text: __("Cancel"), name: 'cancel'} },
},
},
ColorPaletteFactory$MyPalette:
[{
size: 20,
layout: 'horizontal',
addon: ['336699','#9955cc'],
}],
})
.show();
}
catch(e)
{
$$.receiveError(e);
}
$$.unload();