x4js 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/lib/application.d.ts +95 -0
  2. package/lib/application.js +137 -0
  3. package/lib/base64.d.ts +31 -0
  4. package/lib/base64.js +135 -0
  5. package/lib/base_component.d.ts +64 -0
  6. package/lib/base_component.js +77 -0
  7. package/lib/button.d.ts +145 -0
  8. package/lib/button.js +235 -0
  9. package/lib/calendar.d.ts +77 -0
  10. package/lib/calendar.js +236 -0
  11. package/lib/canvas.d.ts +88 -0
  12. package/lib/canvas.js +354 -0
  13. package/lib/cardview.d.ts +83 -0
  14. package/lib/cardview.js +152 -0
  15. package/lib/checkbox.d.ts +72 -0
  16. package/lib/checkbox.js +126 -0
  17. package/lib/color.d.ts +144 -0
  18. package/lib/color.js +584 -0
  19. package/lib/colorpicker.d.ts +98 -0
  20. package/lib/colorpicker.js +1457 -0
  21. package/lib/combobox.d.ts +97 -0
  22. package/lib/combobox.js +246 -0
  23. package/lib/component.d.ts +572 -0
  24. package/lib/component.js +1712 -0
  25. package/lib/datastore.d.ts +392 -0
  26. package/lib/datastore.js +986 -0
  27. package/lib/dialog.d.ts +171 -0
  28. package/lib/dialog.js +468 -0
  29. package/lib/dom_events.d.ts +284 -0
  30. package/lib/dom_events.js +13 -0
  31. package/lib/drag_manager.d.ts +26 -0
  32. package/lib/drag_manager.js +118 -0
  33. package/lib/drawtext.d.ts +43 -0
  34. package/lib/drawtext.js +261 -0
  35. package/lib/fileupload.d.ts +60 -0
  36. package/lib/fileupload.js +158 -0
  37. package/lib/form.d.ts +122 -0
  38. package/lib/form.js +293 -0
  39. package/lib/formatters.d.ts +31 -0
  40. package/lib/formatters.js +75 -0
  41. package/lib/gridview.d.ts +171 -0
  42. package/lib/gridview.js +786 -0
  43. package/lib/hosts/host.d.ts +44 -0
  44. package/lib/hosts/host.js +69 -0
  45. package/lib/i18n.d.ts +67 -0
  46. package/lib/i18n.js +169 -0
  47. package/lib/icon.d.ts +56 -0
  48. package/lib/icon.js +173 -0
  49. package/lib/image.d.ts +51 -0
  50. package/lib/image.js +149 -0
  51. package/lib/index.js +1 -0
  52. package/lib/input.d.ts +86 -0
  53. package/lib/input.js +172 -0
  54. package/lib/label.d.ts +54 -0
  55. package/lib/label.js +86 -0
  56. package/lib/layout.d.ts +77 -0
  57. package/lib/layout.js +261 -0
  58. package/lib/link.d.ts +46 -0
  59. package/lib/link.js +55 -0
  60. package/lib/listview.d.ts +173 -0
  61. package/lib/listview.js +532 -0
  62. package/lib/md5.d.ts +56 -0
  63. package/lib/md5.js +397 -0
  64. package/lib/menu.d.ts +122 -0
  65. package/lib/menu.js +276 -0
  66. package/lib/messagebox.d.ts +64 -0
  67. package/lib/messagebox.js +141 -0
  68. package/lib/panel.d.ts +42 -0
  69. package/lib/panel.js +61 -0
  70. package/lib/popup.d.ts +71 -0
  71. package/lib/popup.js +373 -0
  72. package/lib/property_editor.d.ts +67 -0
  73. package/lib/property_editor.js +247 -0
  74. package/lib/radiobtn.d.ts +68 -0
  75. package/lib/radiobtn.js +131 -0
  76. package/lib/rating.d.ts +49 -0
  77. package/lib/rating.js +93 -0
  78. package/lib/request.d.ts +48 -0
  79. package/lib/request.js +220 -0
  80. package/lib/router.d.ts +13 -0
  81. package/lib/router.js +27 -0
  82. package/lib/settings.d.ts +33 -0
  83. package/lib/settings.js +63 -0
  84. package/lib/sidebarview.d.ts +44 -0
  85. package/lib/sidebarview.js +73 -0
  86. package/lib/smartedit.d.ts +103 -0
  87. package/lib/smartedit.js +381 -0
  88. package/lib/spreadsheet.d.ts +214 -0
  89. package/lib/spreadsheet.js +1073 -0
  90. package/lib/styles.d.ts +81 -0
  91. package/lib/styles.js +262 -0
  92. package/lib/svgcomponent.d.ts +165 -0
  93. package/lib/svgcomponent.js +350 -0
  94. package/lib/tabbar.d.ts +41 -0
  95. package/lib/tabbar.js +66 -0
  96. package/lib/tabview.d.ts +45 -0
  97. package/lib/tabview.js +79 -0
  98. package/lib/textarea.d.ts +59 -0
  99. package/lib/textarea.js +119 -0
  100. package/lib/textedit.d.ts +118 -0
  101. package/lib/textedit.js +406 -0
  102. package/lib/texthiliter.d.ts +56 -0
  103. package/lib/texthiliter.js +219 -0
  104. package/lib/toaster.d.ts +38 -0
  105. package/lib/toaster.js +58 -0
  106. package/lib/tools.d.ts +382 -0
  107. package/lib/tools.js +1096 -0
  108. package/lib/tooltips.d.ts +42 -0
  109. package/lib/tooltips.js +148 -0
  110. package/lib/treeview.d.ts +128 -0
  111. package/lib/treeview.js +490 -0
  112. package/lib/x4_events.d.ts +253 -0
  113. package/lib/x4_events.js +363 -0
  114. package/package.json +21 -0
  115. package/src/README.md +2 -0
  116. package/src/application.ts +191 -0
  117. package/src/base64.ts +162 -0
  118. package/src/base_component.ts +118 -0
  119. package/src/button.ts +327 -0
  120. package/src/calendar.ts +312 -0
  121. package/src/canvas.ts +501 -0
  122. package/src/cardview.ts +220 -0
  123. package/src/checkbox.ts +178 -0
  124. package/src/color.ts +748 -0
  125. package/src/colorpicker.ts +1618 -0
  126. package/src/combobox.ts +348 -0
  127. package/src/component.ts +2330 -0
  128. package/src/datastore.ts +1318 -0
  129. package/src/dialog.ts +631 -0
  130. package/src/dom_events.ts +297 -0
  131. package/src/drag_manager.ts +168 -0
  132. package/src/drawtext.ts +342 -0
  133. package/src/fileupload.ts +208 -0
  134. package/src/form.ts +362 -0
  135. package/src/formatters.ts +96 -0
  136. package/src/gridview.ts +1051 -0
  137. package/src/hosts/electron.ts +161 -0
  138. package/src/hosts/host.ts +100 -0
  139. package/src/hosts/nwjs.ts +141 -0
  140. package/src/hosts/nwjs_types.ts +339 -0
  141. package/src/i18n.ts +205 -0
  142. package/src/icon.ts +237 -0
  143. package/src/image.ts +198 -0
  144. package/src/input.ts +236 -0
  145. package/src/label.ts +124 -0
  146. package/src/layout.ts +366 -0
  147. package/src/link.ts +82 -0
  148. package/src/listview.ts +749 -0
  149. package/src/md5.ts +432 -0
  150. package/src/menu.ts +394 -0
  151. package/src/messagebox.ts +199 -0
  152. package/src/panel.ts +81 -0
  153. package/src/popup.ts +488 -0
  154. package/src/property_editor.ts +333 -0
  155. package/src/radiobtn.ts +190 -0
  156. package/src/rating.ts +131 -0
  157. package/src/request.ts +296 -0
  158. package/src/router.ts +43 -0
  159. package/src/settings.ts +75 -0
  160. package/src/sidebarview.ts +97 -0
  161. package/src/smartedit.ts +532 -0
  162. package/src/spreadsheet.ts +1423 -0
  163. package/src/styles.ts +332 -0
  164. package/src/svgcomponent.ts +440 -0
  165. package/src/tabbar.ts +105 -0
  166. package/src/tabview.ts +106 -0
  167. package/src/textarea.ts +183 -0
  168. package/src/textedit.ts +535 -0
  169. package/src/texthiliter.ts +284 -0
  170. package/src/toaster.ts +76 -0
  171. package/src/tools.ts +1391 -0
  172. package/src/tooltips.ts +185 -0
  173. package/src/treeview.ts +670 -0
  174. package/src/x4.less +1940 -0
  175. package/src/x4_events.ts +558 -0
  176. package/tsconfig.json +14 -0
@@ -0,0 +1,1618 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \/ / / _
4
+ * \ / /_| |_
5
+ * / \____ _|
6
+ * /__/\__\ |_|
7
+ *
8
+ * @file colorpicker.ts
9
+ * @author Etienne Cochard
10
+ * @license
11
+ * Copyright (c) 2019-2021 R-libre ingenierie
12
+ *
13
+ * This program is free software; you can redistribute it and/or modify
14
+ * it under the terms of the GNU General Public License as published by
15
+ * the Free Software Foundation; either version 3 of the License, or
16
+ * (at your option) any later version.
17
+ *
18
+ * This program is distributed in the hope that it will be useful,
19
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ * GNU General Public License for more details.
22
+ *
23
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
24
+ **/
25
+
26
+
27
+ import { Container, Component, ContainerProps, ContainerEventMap } from './component'
28
+ import { CheckBox } from './checkbox'
29
+ import { Dialog, DialogBoxEventMap, DialogProps } from './dialog'
30
+ import { EvChange, EventCallback } from './x4_events'
31
+ import { VLayout, HLayout } from './layout'
32
+ import { Label } from './label'
33
+ import { Color } from './color'
34
+ import { isString, getMousePos, clamp, classNames } from './tools'
35
+ import { TextEdit } from './textedit'
36
+ import { Menu, MenuItem } from './menu'
37
+
38
+ interface ColorPickerEventMap extends ContainerEventMap {
39
+ change: EvChange;
40
+ }
41
+
42
+ export interface ColorPickerProps extends ContainerProps<ColorPickerEventMap> {
43
+ color: Color;
44
+ hasAlpha?: boolean;
45
+ }
46
+
47
+ const pal_colors = {
48
+ blue: [0x0e5a8a, 0x106ba3, 0x137cbd, 0x2b95d6, 0x48aff0,],
49
+ green: [0x0a6640, 0x0d8050, 0x0f9960, 0x15b371, 0x3dcc91,],
50
+ orange: [0xa66321, 0xbf7326, 0xd9822b, 0xf29d49, 0xffb366,],
51
+ red: [0xa82a2a, 0xc23030, 0xdb3737, 0xf55656, 0xff7373,],
52
+ vermilion: [0x9e2b0e, 0xb83211, 0xd13913, 0xeb532d, 0xff6e4a,],
53
+ rose: [0xa82255, 0xc22762, 0xdb2c6f, 0xf5498b, 0xff66a1,],
54
+ violet: [0x5c255c, 0x752f75, 0x8f398f, 0xa854a8, 0xc274c2,],
55
+ indigo: [0x5642a6, 0x634dbf, 0x7157d9, 0x9179f2, 0xad99ff,],
56
+ cobalt: [0x1f4b99, 0x2458b3, 0x2965cc, 0x4580e6, 0x669eff,],
57
+ turquoise: [0x008075, 0x00998c, 0x00b3a4, 0x14ccbd, 0x2ee6d6,],
58
+ forest: [0x1d7324, 0x238c2c, 0x29a634, 0x43bf4d, 0x62d96b,],
59
+ lime: [0x728c23, 0x87a629, 0x9bbf30, 0xb6d94c, 0xd1f26d,],
60
+ gold: [0xa67908, 0xbf8c0a, 0xd99e0b, 0xf2b824, 0xffc940,],
61
+ sepia: [0x63411e, 0x7d5125, 0x96622d, 0xb07b46, 0xc99765,],
62
+ bw: [0x000000, 0x444444, 0x666666, 0xcccccc, 0xffffff,],
63
+ };
64
+
65
+
66
+
67
+ export class ColorPicker extends Container<ColorPickerProps, ColorPickerEventMap> {
68
+
69
+ private m_colorSel: Component;
70
+ private m_colorHue: Component;
71
+ private m_colorAlpha: Component;
72
+ private m_sample: Component;
73
+ private m_selMark: Component;
74
+ private m_hueMark: Component;
75
+ private m_alphaMark: Component;
76
+
77
+ private m_baseHSV: { h: number, s: number, v: number, a: number };
78
+ private m_baseColor: Color;
79
+ private m_transpCk: CheckBox;
80
+ private m_colorEdit: TextEdit;
81
+
82
+ private m_palmode: boolean;
83
+
84
+ static last_palmode = false;
85
+
86
+ constructor(props: ColorPickerProps) {
87
+ super(props);
88
+ this.m_palmode = ColorPicker.last_palmode;
89
+ this.setDomEvent('contextmenu', (e) => this._showCtx(e));
90
+ }
91
+
92
+ private _showCtx(e: UIEvent) {
93
+ const menu = new Menu({
94
+ items: [
95
+ new MenuItem({
96
+ text: 'Palette', checked: this.m_palmode, click: () => {
97
+ this.m_palmode = !this.m_palmode;
98
+ ColorPicker.last_palmode = this.m_palmode;
99
+ this.update();
100
+ }
101
+ })
102
+ ]
103
+ })
104
+
105
+ let pt = getMousePos(e, true);
106
+ menu.displayAt(pt.x, pt.y);
107
+ }
108
+
109
+ render(props: ColorPickerProps) {
110
+
111
+ this.m_baseColor = props.color;
112
+ this.m_baseHSV = Color.toHSV(this.m_baseColor);
113
+
114
+ if (this.m_palmode) {
115
+
116
+ this.addClass("pal-mode");
117
+
118
+ let selector = null;
119
+ let cur = null;
120
+
121
+ let main_sel = [];
122
+ let sub_sel = [];
123
+
124
+ const ccolor = this.m_baseColor.value();
125
+
126
+ materialColors.forEach(mc => {
127
+ const color = mc.variations[4].hex;
128
+
129
+ let selected = color === ccolor;
130
+ if( !selected ) {
131
+ selected = mc.variations.some( c => {
132
+ const cc = new Color(c.hex).value();
133
+ if( cc===ccolor ) {
134
+ return true;
135
+ }
136
+ });
137
+ }
138
+
139
+ let cls = classNames('clr-box xbox', { selected });
140
+ let el = new Component({
141
+ cls,
142
+ style: { backgroundColor: new Color(color).toHex() },
143
+ data: { color, main: mc.variations }
144
+ });
145
+
146
+ if( selected ) {
147
+ fillSubs( mc.variations );
148
+ }
149
+
150
+ main_sel.push(el);
151
+ });
152
+
153
+ function fillSubs( colors ) {
154
+ sub_sel = [];
155
+ colors.forEach(mc => {
156
+ let clr = new Color(mc.hex);
157
+ const selected = clr.value() == ccolor;
158
+
159
+ let cls = classNames('hclr-box xbox', { selected });
160
+
161
+ let el = new Component({
162
+ cls,
163
+ style: { backgroundColor: clr.toHex(), color: Color.contrastColor(clr).toHex() },
164
+ data: { color: clr.value() } ,
165
+ content: clr.toHex()
166
+ });
167
+
168
+ sub_sel.push(el);
169
+
170
+ if( selected ) {
171
+ cur = el;
172
+ }
173
+ });
174
+
175
+ if( selector ) {
176
+ selector.itemWithId('vsel').setContent( sub_sel );
177
+ }
178
+ }
179
+
180
+ selector = new VLayout({
181
+ content: [
182
+ new HLayout({
183
+ id: 'hsel',
184
+ content: main_sel
185
+ }),
186
+ new VLayout({
187
+ id: 'vsel',
188
+ flex: 1,
189
+ content: sub_sel
190
+ })
191
+ ]
192
+ });
193
+
194
+
195
+ /*
196
+ let cur = null;
197
+ const buildCol = ( colors: number[] ) => {
198
+
199
+ const ccolor = this.m_baseColor.value();
200
+ const els = colors.map( x => {
201
+ const selected = x==ccolor;
202
+
203
+ let cls = classNames( 'clr-box', { selected } );
204
+ let el = new Component( { cls, style: { backgroundColor: new Color(x).toHex() }, data: { color: x } } );
205
+
206
+ if( selected ) {
207
+ cur = el;
208
+ }
209
+ return el;
210
+ });
211
+
212
+ return new VLayout( {
213
+ cls: 'vcol',
214
+ content: els
215
+ });
216
+ }
217
+
218
+ let rows = new HLayout( {
219
+ cls: 'hcol',
220
+ content: [
221
+ buildCol( pal_colors.blue ),
222
+ buildCol( pal_colors.green ),
223
+ buildCol( pal_colors.orange ),
224
+ buildCol( pal_colors.red ),
225
+ buildCol( pal_colors.vermilion ),
226
+ buildCol( pal_colors.rose ),
227
+ buildCol( pal_colors.violet ),
228
+ buildCol( pal_colors.indigo ),
229
+ buildCol( pal_colors.cobalt ),
230
+ buildCol( pal_colors.turquoise ),
231
+ buildCol( pal_colors.forest ),
232
+ buildCol( pal_colors.lime ),
233
+ buildCol( pal_colors.gold ),
234
+ buildCol( pal_colors.sepia ),
235
+ buildCol( pal_colors.bw ),
236
+ ]
237
+ });
238
+ */
239
+
240
+
241
+ this.m_colorEdit = new TextEdit({
242
+ cls: 'hexv',
243
+ value: '',
244
+ attrs: {
245
+ spellcheck: false,
246
+ },
247
+ change: (ev) => {
248
+ const clr = new Color(ev.value);
249
+ if (clr) {
250
+ this.m_baseColor = clr;
251
+ this.m_baseHSV = Color.toHSV(clr);
252
+ this._updateColor(false);
253
+ }
254
+ }
255
+ });
256
+
257
+ this.m_transpCk = new CheckBox({
258
+ cls: 'transp',
259
+ text: 'transparent',
260
+ change: (ev) => {
261
+ this.m_baseHSV.a = ev.value ? 0 : 1;
262
+ this._updateColor();
263
+ }
264
+ });
265
+
266
+ this.setContent([selector, this.m_transpCk, this.m_colorEdit]);
267
+
268
+ // globally handle click
269
+
270
+ selector.setDomEvent('click', (ev) => {
271
+
272
+ if (cur) {
273
+ cur.removeClass('selected');
274
+ cur = null;
275
+ }
276
+
277
+ let cell = Component.getElement(ev.target as HTMLElement, 'xbox');
278
+ if (cell) {
279
+ const subs = cell.getData('main');
280
+ if( subs ) {
281
+ fillSubs( subs );
282
+ }
283
+ else {
284
+ const clr = new Color(cell.getData('color'));
285
+ this.m_baseColor = clr;
286
+ this.m_baseHSV = Color.toHSV(clr);
287
+ this._updateColor();
288
+
289
+ cur = cell;
290
+ cell.addClass('selected');
291
+ }
292
+ }
293
+
294
+ });
295
+ }
296
+ else {
297
+ this.removeClass("pal-mode");
298
+
299
+ this.m_selMark = new Component({ cls: 'marker' });
300
+ this.m_colorSel = new Component({
301
+ cls: 'sel',
302
+ content: [
303
+ new Component({ cls: '@fit light' }),
304
+ new Component({ cls: '@fit dark' }),
305
+ this.m_selMark,
306
+ ]
307
+ });
308
+
309
+ this.m_hueMark = new Component({ cls: 'marker' });
310
+ this.m_colorHue = new Component({
311
+ cls: 'hue',
312
+ content: [
313
+ this.m_hueMark
314
+ ]
315
+ });
316
+ this.m_sample = new Component({ cls: 'sample' });
317
+
318
+ if (props.hasAlpha) {
319
+ this.addClass('with-alpha');
320
+ this.m_alphaMark = new Component({ cls: 'marker' });
321
+ this.m_colorAlpha = new Component({
322
+ cls: 'alpha',
323
+ content: [
324
+ new Component({ cls: 'bk @fit', ref: 'color' }),
325
+ this.m_alphaMark
326
+ ]
327
+ });
328
+ }
329
+ else {
330
+ this.removeClass('with-alpha');
331
+ this.m_transpCk = new CheckBox({
332
+ cls: 'transp',
333
+ text: 'transparent',
334
+ change: (ev) => {
335
+ this.m_baseHSV.a = ev.value ? 0 : 1;
336
+ this._updateColor();
337
+ }
338
+ });
339
+ }
340
+
341
+ this.m_colorEdit = new TextEdit({
342
+ cls: 'hexv',
343
+ value: '',
344
+ attrs: {
345
+ spellcheck: false,
346
+ },
347
+ change: (ev) => {
348
+ const clr = new Color(ev.value);
349
+ if (clr) {
350
+ this.m_baseColor = clr;
351
+ this.m_baseHSV = Color.toHSV(clr);
352
+ this._updateColor(false);
353
+ }
354
+ }
355
+ });
356
+
357
+ this.setContent([
358
+ this.m_colorSel,
359
+ this.m_colorHue,
360
+ this.m_colorAlpha,
361
+ this.m_transpCk,
362
+ this.m_colorEdit,
363
+ this.m_sample,
364
+ ]);
365
+
366
+ this.m_colorSel.setDomEvent('mousedown', (ev: MouseEvent) => {
367
+ Component.setCapture(this, (e) => this._selChange(e));
368
+ });
369
+
370
+ this.m_colorHue.setDomEvent('mousedown', (ev: MouseEvent) => {
371
+ Component.setCapture(this, (e) => this._hueChange(e));
372
+ });
373
+
374
+ if (props.hasAlpha) {
375
+ this.m_colorAlpha.setDomEvent('mousedown', (ev: MouseEvent) => {
376
+ Component.setCapture(this, (e) => this._alphaChange(e));
377
+ });
378
+ }
379
+
380
+ this._updateColor();
381
+ }
382
+ }
383
+
384
+ set color(clr: Color) {
385
+ this.m_baseColor = clr;
386
+ this.m_baseHSV = Color.toHSV(this.m_baseColor);
387
+
388
+ this._updateColor();
389
+ }
390
+
391
+ get color() {
392
+ return this.m_baseColor;
393
+ }
394
+
395
+ private _selChange(ev: UIEvent) {
396
+ let pt = getMousePos(ev, true);
397
+ console.log(pt);
398
+ let rc = this.m_colorSel.getBoundingRect();
399
+
400
+ if (!this.m_props.hasAlpha) {
401
+ this.m_baseHSV.a = 1;
402
+ }
403
+
404
+ this.m_baseHSV.s = clamp((pt.x - rc.left) / rc.width, 0, 1);
405
+ this.m_baseHSV.v = 1 - clamp((pt.y - rc.top) / rc.height, 0, 1);
406
+ this._updateColor();
407
+
408
+ if (ev.type == 'mouseup' || ev.type == 'touchend') {
409
+ Component.releaseCapture();
410
+ }
411
+ }
412
+
413
+ private _hueChange(ev: UIEvent) {
414
+ let pt = getMousePos(ev, true);
415
+ let rc = this.m_colorHue.getBoundingRect();
416
+
417
+ this.m_baseHSV.h = clamp((pt.y - rc.top) / rc.height, 0, 1);
418
+ this._updateColor();
419
+
420
+ if (ev.type == 'mouseup' || ev.type == 'touchend') {
421
+ Component.releaseCapture();
422
+ }
423
+ }
424
+
425
+ private _alphaChange(ev: UIEvent) {
426
+ let pt = getMousePos(ev, true);
427
+ let rc = this.m_colorAlpha.getBoundingRect();
428
+
429
+ this.m_baseHSV.a = clamp((pt.x - rc.left) / rc.width, 0, 1);
430
+ this._updateColor();
431
+
432
+ if (ev.type == 'mouseup' || ev.type == 'touchend') {
433
+ Component.releaseCapture();
434
+ }
435
+ }
436
+
437
+ private _updateColor(edit = true) {
438
+
439
+ let color: Color;
440
+
441
+ if (!this.m_palmode) {
442
+
443
+ color = Color.fromHSV(this.m_baseHSV.h, 1, 1, 1);
444
+ this.m_colorSel.setStyleValue('backgroundColor', color.toString());
445
+
446
+ color = Color.fromHSV(this.m_baseHSV.h, this.m_baseHSV.s, this.m_baseHSV.v, 1);
447
+ this.m_sample.setStyleValue('backgroundColor', color.toString());
448
+
449
+ if (this.m_props.hasAlpha) {
450
+ let gradient = `linear-gradient(to right, rgba(0,0,0,0) 0%, ${color.toString()} 100%)`;
451
+ this.m_colorAlpha.itemWithRef<Component>('color').setStyleValue('backgroundImage', gradient);
452
+ }
453
+
454
+ this.m_selMark.setStyle({
455
+ left: (this.m_baseHSV.s * 100) + '%',
456
+ top: (100 - this.m_baseHSV.v * 100) + '%',
457
+ });
458
+
459
+ this.m_hueMark.setStyle({
460
+ top: (this.m_baseHSV.h * 100) + '%',
461
+ });
462
+
463
+ if (this.m_props.hasAlpha) {
464
+ this.m_alphaMark.setStyle({
465
+ left: (this.m_baseHSV.a * 100) + '%',
466
+ });
467
+ }
468
+ else {
469
+ this.m_transpCk.check = this.m_baseHSV.a == 0;
470
+ }
471
+ }
472
+ else {
473
+ this.m_transpCk.check = this.m_baseHSV.a == 0;
474
+ }
475
+
476
+ color = Color.fromHSV(this.m_baseHSV.h, this.m_baseHSV.s, this.m_baseHSV.v, this.m_baseHSV.a);
477
+ this.m_baseColor = color;
478
+
479
+ if (edit) {
480
+ this.m_colorEdit.value = color.alpha() == 1 ? color.toHex() : color.toString() //color.toHex();
481
+ }
482
+
483
+ this._change();
484
+ }
485
+
486
+ private _change() {
487
+ this.emit('change', EvChange(this.m_baseColor));
488
+ }
489
+ }
490
+
491
+ // :: color dialog ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
492
+
493
+ interface ColorPickerBoxEventMap extends DialogBoxEventMap {
494
+ change: EvChange;
495
+ }
496
+
497
+ export interface ColorPickerBoxProps extends DialogProps<ColorPickerBoxEventMap> {
498
+ color: Color;
499
+ hasAlpha?: boolean;
500
+ cust_colors?: Color[];
501
+
502
+ change?: EventCallback<EvChange>; // shortcut to { event: change: ... }
503
+ }
504
+
505
+
506
+ export class ColorPickerBox extends Dialog<ColorPickerBoxProps, ColorPickerBoxEventMap>
507
+ {
508
+ private m_picker: ColorPicker;
509
+
510
+ constructor(props: ColorPickerBoxProps) {
511
+
512
+ props.icon = undefined;
513
+ props.buttons = undefined;
514
+
515
+ super(props);
516
+
517
+ this.mapPropEvents(props, 'change');
518
+
519
+ this.m_picker = new ColorPicker({
520
+ color: props.color,
521
+ hasAlpha: props.hasAlpha,
522
+ style: { padding: 8 },
523
+ width: 250,
524
+ height: 250,
525
+ });
526
+
527
+ let customs = this._makeCustoms(props.cust_colors);
528
+
529
+ this.form.updateContent([
530
+ new VLayout({
531
+ content: [
532
+ this.m_picker,
533
+ customs
534
+ ]
535
+ })
536
+ ], ['ok', 'cancel']);
537
+
538
+ this.on('btnClick', (ev) => {
539
+ if (ev.button == 'ok') {
540
+ this.emit('change', EvChange(this.m_picker.color));
541
+ }
542
+ });
543
+ }
544
+
545
+ private _makeCustoms(cc) {
546
+
547
+ let custom = null;
548
+
549
+ if (cc && cc.length > 0) {
550
+
551
+ let els = [];
552
+
553
+ for (let i = 0; i < cc.length; i += 8) {
554
+
555
+ let lne = [];
556
+
557
+ for (let j = 0; j < 8; j++) {
558
+
559
+ let idx = i + j,
560
+ clr = cc[idx];
561
+
562
+ lne.push(new Label({
563
+ cls: 'cust-cc',
564
+ text: '',
565
+ flex: 1,
566
+ style: {
567
+ backgroundColor: clr ? clr.toString() : 'transparent'
568
+ },
569
+ tooltip: clr ? clr.toString() : undefined,
570
+ dom_events: {
571
+ click: () => {
572
+ if (clr) {
573
+ this.m_picker.color = clr;
574
+ this.emit('change', EvChange(clr));
575
+ this.close();
576
+ }
577
+ }
578
+ }
579
+ }));
580
+ }
581
+
582
+ els.push(new HLayout({ cls: 'line', content: lne }));
583
+ }
584
+
585
+ custom = new VLayout({ cls: 'customs', content: els });
586
+ }
587
+
588
+ return custom;
589
+ }
590
+
591
+ set color(clr: Color) {
592
+ this.m_picker.color = clr;
593
+ }
594
+
595
+ get color() {
596
+ return this.m_picker.color;
597
+ }
598
+
599
+ /**
600
+ * display a messagebox
601
+ */
602
+
603
+ static show(props: string | ColorPickerBoxProps): ColorPickerBox {
604
+
605
+ let msg;
606
+
607
+ if (isString(props)) {
608
+ msg = new ColorPickerBox({ color: new Color(props) });
609
+ }
610
+ else {
611
+ msg = new ColorPickerBox(props);
612
+ }
613
+
614
+ msg.show();
615
+ return msg;
616
+ }
617
+ }
618
+
619
+ // :: PickerEditor ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
620
+
621
+ export interface ColorPickerEditorProps extends ColorPickerProps {
622
+ label?: string;
623
+ labelWidth?: number;
624
+ cust_colors?: Color[];
625
+
626
+ change: EventCallback<EvChange>;
627
+ }
628
+
629
+ export class ColorPickerEditor extends HLayout<ColorPickerEditorProps, ColorPickerEventMap> {
630
+
631
+ constructor(props: ColorPickerEditorProps) {
632
+ super(props);
633
+
634
+ this.mapPropEvents(props, 'change');
635
+ }
636
+
637
+ render(props: ColorPickerEditorProps) {
638
+
639
+ let color = props.color;
640
+ let tcolor: string;
641
+
642
+ if (this._isTransp(color)) {
643
+ color = Color.NONE;
644
+ tcolor = 'black';
645
+ }
646
+ else {
647
+ tcolor = Color.contrastColor(color).toString();
648
+ }
649
+
650
+ this.setContent([
651
+ props.label ? new Label({
652
+ cls: 'label',
653
+ text: props.label,
654
+ flex: props.labelWidth < 0 ? -props.labelWidth : undefined,
655
+ width: props.labelWidth >= 0 ? props.labelWidth : undefined,
656
+ }) : null,
657
+ new Label({
658
+ cls: 'value',
659
+ flex: 1,
660
+ text: color.toHex(),
661
+ style: {
662
+ backgroundColor: color.toString(),
663
+ color: tcolor
664
+ },
665
+ dom_events: {
666
+ click: () => this._showPicker()
667
+ }
668
+ })
669
+ ]);
670
+
671
+ this._setTabIndex(props.tabIndex);
672
+ }
673
+
674
+ set value(color: Color) {
675
+ this.m_props.color = color;
676
+ this.update();
677
+ }
678
+
679
+ get value() {
680
+ return this.m_props.color;
681
+ }
682
+
683
+ set custom_colors(v: Color[]) {
684
+ this.m_props.cust_colors = v;
685
+ }
686
+
687
+ private _showPicker() {
688
+ let dlg = new ColorPickerBox({
689
+ color: this.m_props.color,
690
+ cust_colors: this.m_props.cust_colors,
691
+ hasAlpha: this.m_props.hasAlpha,
692
+ events: {
693
+ change: (e) => {
694
+ this.m_props.color = e.value as Color;
695
+ this._change();
696
+ this.update();
697
+ }
698
+ }
699
+ });
700
+
701
+ let rc = this.getBoundingRect();
702
+ dlg.displayAt(rc.left, rc.bottom, 'tl');
703
+ }
704
+
705
+ private _change() {
706
+ this.emit('change', EvChange(this.m_props.color));
707
+ }
708
+
709
+ private _isTransp(color: Color) {
710
+ return !color.alpha();
711
+ }
712
+ }
713
+
714
+
715
+ // :: Material colors scheme ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
716
+
717
+ const materialColors = [
718
+ {
719
+ color: "Red",
720
+ variations: [
721
+ {
722
+ weight: 50,
723
+ hex: 0xFFEBEE
724
+ },
725
+ {
726
+ weight: 100,
727
+ hex: 0xFFCDD2
728
+ },
729
+ {
730
+ weight: 200,
731
+ hex: 0xEF9A9A
732
+ },
733
+ {
734
+ weight: 300,
735
+ hex: 0xE57373
736
+ },
737
+ {
738
+ weight: 400,
739
+ hex: 0xEF5350
740
+ },
741
+ {
742
+ weight: 500,
743
+ hex: 0xF44336
744
+ },
745
+ {
746
+ weight: 600,
747
+ hex: 0xE53935
748
+ },
749
+ {
750
+ weight: 700,
751
+ hex: 0xD32F2F
752
+ },
753
+ {
754
+ weight: 800,
755
+ hex: 0xC62828
756
+ },
757
+ {
758
+ weight: 900,
759
+ hex: 0xB71C1C
760
+ }
761
+ ]
762
+ },
763
+ {
764
+ color: "Pink",
765
+ variations: [
766
+ {
767
+ weight: 50,
768
+ hex: 0xFCE4EC
769
+ },
770
+ {
771
+ weight: 100,
772
+ hex: 0xF8BBD0
773
+ },
774
+ {
775
+ weight: 200,
776
+ hex: 0xF48FB1
777
+ },
778
+ {
779
+ weight: 300,
780
+ hex: 0xF06292
781
+ },
782
+ {
783
+ weight: 400,
784
+ hex: 0xEC407A
785
+ },
786
+ {
787
+ weight: 500,
788
+ hex: 0xE91E63
789
+ },
790
+ {
791
+ weight: 600,
792
+ hex: 0xD81B60
793
+ },
794
+ {
795
+ weight: 700,
796
+ hex: 0xC2185B
797
+ },
798
+ {
799
+ weight: 800,
800
+ hex: 0xAD1457
801
+ },
802
+ {
803
+ weight: 900,
804
+ hex: 0x880E4F
805
+ }
806
+ ]
807
+ },
808
+ {
809
+ color: "Purple",
810
+ variations: [
811
+ {
812
+ weight: 50,
813
+ hex: 0xF3E5F5
814
+ },
815
+ {
816
+ weight: 100,
817
+ hex: 0xE1BEE7
818
+ },
819
+ {
820
+ weight: 200,
821
+ hex: 0xCE93D8
822
+ },
823
+ {
824
+ weight: 300,
825
+ hex: 0xBA68C8
826
+ },
827
+ {
828
+ weight: 400,
829
+ hex: 0xAB47BC
830
+ },
831
+ {
832
+ weight: 500,
833
+ hex: 0x9C27B0
834
+ },
835
+ {
836
+ weight: 600,
837
+ hex: 0x8E24AA
838
+ },
839
+ {
840
+ weight: 700,
841
+ hex: 0x7B1FA2
842
+ },
843
+ {
844
+ weight: 800,
845
+ hex: 0x6A1B9A
846
+ },
847
+ {
848
+ weight: 900,
849
+ hex: 0x4A148C
850
+ }
851
+ ]
852
+ },
853
+ {
854
+ color: "Deep Purple",
855
+ variations: [
856
+ {
857
+ weight: 50,
858
+ hex: 0xEDE7F6
859
+ },
860
+ {
861
+ weight: 100,
862
+ hex: 0xD1C4E9
863
+ },
864
+ {
865
+ weight: 200,
866
+ hex: 0xB39DDB
867
+ },
868
+ {
869
+ weight: 300,
870
+ hex: 0x9575CD
871
+ },
872
+ {
873
+ weight: 400,
874
+ hex: 0x7E57C2
875
+ },
876
+ {
877
+ weight: 500,
878
+ hex: 0x673AB7
879
+ },
880
+ {
881
+ weight: 600,
882
+ hex: 0x5E35B1
883
+ },
884
+ {
885
+ weight: 700,
886
+ hex: 0x512DA8
887
+ },
888
+ {
889
+ weight: 800,
890
+ hex: 0x4527A0
891
+ },
892
+ {
893
+ weight: 900,
894
+ hex: 0x311B92
895
+ }
896
+ ]
897
+ },
898
+ {
899
+ color: "Indigo",
900
+ variations: [
901
+ {
902
+ weight: 50,
903
+ hex: 0xE8EAF6
904
+ },
905
+ {
906
+ weight: 100,
907
+ hex: 0xC5CAE9
908
+ },
909
+ {
910
+ weight: 200,
911
+ hex: 0x9FA8DA
912
+ },
913
+ {
914
+ weight: 300,
915
+ hex: 0x7986CB
916
+ },
917
+ {
918
+ weight: 400,
919
+ hex: 0x5C6BC0
920
+ },
921
+ {
922
+ weight: 500,
923
+ hex: 0x3F51B5
924
+ },
925
+ {
926
+ weight: 600,
927
+ hex: 0x3949AB
928
+ },
929
+ {
930
+ weight: 700,
931
+ hex: 0x303F9F
932
+ },
933
+ {
934
+ weight: 800,
935
+ hex: 0x283593
936
+ },
937
+ {
938
+ weight: 900,
939
+ hex: 0x1A237E
940
+ }
941
+ ]
942
+ },
943
+ {
944
+ color: "Blue",
945
+ variations: [
946
+ {
947
+ weight: 50,
948
+ hex: 0xE3F2FD
949
+ },
950
+ {
951
+ weight: 100,
952
+ hex: 0xBBDEFB
953
+ },
954
+ {
955
+ weight: 200,
956
+ hex: 0x90CAF9
957
+ },
958
+ {
959
+ weight: 300,
960
+ hex: 0x64B5F6
961
+ },
962
+ {
963
+ weight: 400,
964
+ hex: 0x42A5F5
965
+ },
966
+ {
967
+ weight: 500,
968
+ hex: 0x2196F3
969
+ },
970
+ {
971
+ weight: 600,
972
+ hex: 0x1E88E5
973
+ },
974
+ {
975
+ weight: 700,
976
+ hex: 0x1976D2
977
+ },
978
+ {
979
+ weight: 800,
980
+ hex: 0x1565C0
981
+ },
982
+ {
983
+ weight: 900,
984
+ hex: 0x0D47A1
985
+ }
986
+ ]
987
+ },
988
+ {
989
+ color: "Light Blue",
990
+ variations: [
991
+ {
992
+ weight: 50,
993
+ hex: 0xE1F5FE
994
+ },
995
+ {
996
+ weight: 100,
997
+ hex: 0xB3E5FC
998
+ },
999
+ {
1000
+ weight: 200,
1001
+ hex: 0x81D4FA
1002
+ },
1003
+ {
1004
+ weight: 300,
1005
+ hex: 0x4FC3F7
1006
+ },
1007
+ {
1008
+ weight: 400,
1009
+ hex: 0x29B6F6
1010
+ },
1011
+ {
1012
+ weight: 500,
1013
+ hex: 0x03A9F4
1014
+ },
1015
+ {
1016
+ weight: 600,
1017
+ hex: 0x039BE5
1018
+ },
1019
+ {
1020
+ weight: 700,
1021
+ hex: 0x0288D1
1022
+ },
1023
+ {
1024
+ weight: 800,
1025
+ hex: 0x0277BD
1026
+ },
1027
+ {
1028
+ weight: 900,
1029
+ hex: 0x01579B
1030
+ }
1031
+ ]
1032
+ },
1033
+ {
1034
+ color: "Cyan",
1035
+ variations: [
1036
+ {
1037
+ weight: 50,
1038
+ hex: 0xE0F7FA
1039
+ },
1040
+ {
1041
+ weight: 100,
1042
+ hex: 0xB2EBF2
1043
+ },
1044
+ {
1045
+ weight: 200,
1046
+ hex: 0x80DEEA
1047
+ },
1048
+ {
1049
+ weight: 300,
1050
+ hex: 0x4DD0E1
1051
+ },
1052
+ {
1053
+ weight: 400,
1054
+ hex: 0x26C6DA
1055
+ },
1056
+ {
1057
+ weight: 500,
1058
+ hex: 0x00BCD4
1059
+ },
1060
+ {
1061
+ weight: 600,
1062
+ hex: 0x00ACC1
1063
+ },
1064
+ {
1065
+ weight: 700,
1066
+ hex: 0x0097A7
1067
+ },
1068
+ {
1069
+ weight: 800,
1070
+ hex: 0x00838F
1071
+ },
1072
+ {
1073
+ weight: 900,
1074
+ hex: 0x006064
1075
+ }
1076
+ ]
1077
+ },
1078
+ {
1079
+ color: "Teal",
1080
+ variations: [
1081
+ {
1082
+ weight: 50,
1083
+ hex: 0xE0F2F1
1084
+ },
1085
+ {
1086
+ weight: 100,
1087
+ hex: 0xB2DFDB
1088
+ },
1089
+ {
1090
+ weight: 200,
1091
+ hex: 0x80CBC4
1092
+ },
1093
+ {
1094
+ weight: 300,
1095
+ hex: 0x4DB6AC
1096
+ },
1097
+ {
1098
+ weight: 400,
1099
+ hex: 0x26A69A
1100
+ },
1101
+ {
1102
+ weight: 500,
1103
+ hex: 0x009688
1104
+ },
1105
+ {
1106
+ weight: 600,
1107
+ hex: 0x00897B
1108
+ },
1109
+ {
1110
+ weight: 700,
1111
+ hex: 0x00796B
1112
+ },
1113
+ {
1114
+ weight: 800,
1115
+ hex: 0x00695C
1116
+ },
1117
+ {
1118
+ weight: 900,
1119
+ hex: 0x004D40
1120
+ }
1121
+ ]
1122
+ },
1123
+ {
1124
+ color: "Green",
1125
+ variations: [
1126
+ {
1127
+ weight: 50,
1128
+ hex: 0xE8F5E9
1129
+ },
1130
+ {
1131
+ weight: 100,
1132
+ hex: 0xC8E6C9
1133
+ },
1134
+ {
1135
+ weight: 200,
1136
+ hex: 0xA5D6A7
1137
+ },
1138
+ {
1139
+ weight: 300,
1140
+ hex: 0x81C784
1141
+ },
1142
+ {
1143
+ weight: 400,
1144
+ hex: 0x66BB6A
1145
+ },
1146
+ {
1147
+ weight: 500,
1148
+ hex: 0x4CAF50
1149
+ },
1150
+ {
1151
+ weight: 600,
1152
+ hex: 0x43A047
1153
+ },
1154
+ {
1155
+ weight: 700,
1156
+ hex: 0x388E3C
1157
+ },
1158
+ {
1159
+ weight: 800,
1160
+ hex: 0x2E7D32
1161
+ },
1162
+ {
1163
+ weight: 900,
1164
+ hex: 0x1B5E20
1165
+ }
1166
+ ]
1167
+ },
1168
+ {
1169
+ color: "Light Green",
1170
+ variations: [
1171
+ {
1172
+ weight: 50,
1173
+ hex: 0xF1F8E9
1174
+ },
1175
+ {
1176
+ weight: 100,
1177
+ hex: 0xDCEDC8
1178
+ },
1179
+ {
1180
+ weight: 200,
1181
+ hex: 0xC5E1A5
1182
+ },
1183
+ {
1184
+ weight: 300,
1185
+ hex: 0xAED581
1186
+ },
1187
+ {
1188
+ weight: 400,
1189
+ hex: 0x9CCC65
1190
+ },
1191
+ {
1192
+ weight: 500,
1193
+ hex: 0x8BC34A
1194
+ },
1195
+ {
1196
+ weight: 600,
1197
+ hex: 0x7CB342
1198
+ },
1199
+ {
1200
+ weight: 700,
1201
+ hex: 0x689F38
1202
+ },
1203
+ {
1204
+ weight: 800,
1205
+ hex: 0x558B2F
1206
+ },
1207
+ {
1208
+ weight: 900,
1209
+ hex: 0x33691E
1210
+ }
1211
+ ]
1212
+ },
1213
+ {
1214
+ color: "Lime",
1215
+ variations: [
1216
+ {
1217
+ weight: 50,
1218
+ hex: 0xF9FBE7
1219
+ },
1220
+ {
1221
+ weight: 100,
1222
+ hex: 0xF0F4C3
1223
+ },
1224
+ {
1225
+ weight: 200,
1226
+ hex: 0xE6EE9C
1227
+ },
1228
+ {
1229
+ weight: 300,
1230
+ hex: 0xDCE775
1231
+ },
1232
+ {
1233
+ weight: 400,
1234
+ hex: 0xD4E157
1235
+ },
1236
+ {
1237
+ weight: 500,
1238
+ hex: 0xCDDC39
1239
+ },
1240
+ {
1241
+ weight: 600,
1242
+ hex: 0xC0CA33
1243
+ },
1244
+ {
1245
+ weight: 700,
1246
+ hex: 0xAFB42B
1247
+ },
1248
+ {
1249
+ weight: 800,
1250
+ hex: 0x9E9D24
1251
+ },
1252
+ {
1253
+ weight: 900,
1254
+ hex: 0x827717
1255
+ }
1256
+ ]
1257
+ },
1258
+ {
1259
+ color: "Yellow",
1260
+ variations: [
1261
+ {
1262
+ weight: 50,
1263
+ hex: 0xFFFDE7
1264
+ },
1265
+ {
1266
+ weight: 100,
1267
+ hex: 0xFFF9C4
1268
+ },
1269
+ {
1270
+ weight: 200,
1271
+ hex: 0xFFF59D
1272
+ },
1273
+ {
1274
+ weight: 300,
1275
+ hex: 0xFFF176
1276
+ },
1277
+ {
1278
+ weight: 400,
1279
+ hex: 0xFFEE58
1280
+ },
1281
+ {
1282
+ weight: 500,
1283
+ hex: 0xFFEB3B
1284
+ },
1285
+ {
1286
+ weight: 600,
1287
+ hex: 0xFDD835
1288
+ },
1289
+ {
1290
+ weight: 700,
1291
+ hex: 0xFBC02D
1292
+ },
1293
+ {
1294
+ weight: 800,
1295
+ hex: 0xF9A825
1296
+ },
1297
+ {
1298
+ weight: 900,
1299
+ hex: 0xF57F17
1300
+ }
1301
+ ]
1302
+ },
1303
+ {
1304
+ color: "Amber",
1305
+ variations: [
1306
+ {
1307
+ weight: 50,
1308
+ hex: 0xFFF8E1
1309
+ },
1310
+ {
1311
+ weight: 100,
1312
+ hex: 0xFFECB3
1313
+ },
1314
+ {
1315
+ weight: 200,
1316
+ hex: 0xFFE082
1317
+ },
1318
+ {
1319
+ weight: 300,
1320
+ hex: 0xFFD54F
1321
+ },
1322
+ {
1323
+ weight: 400,
1324
+ hex: 0xFFCA28
1325
+ },
1326
+ {
1327
+ weight: 500,
1328
+ hex: 0xFFC107
1329
+ },
1330
+ {
1331
+ weight: 600,
1332
+ hex: 0xFFB300
1333
+ },
1334
+ {
1335
+ weight: 700,
1336
+ hex: 0xFFA000
1337
+ },
1338
+ {
1339
+ weight: 800,
1340
+ hex: 0xFF8F00
1341
+ },
1342
+ {
1343
+ weight: 900,
1344
+ hex: 0xFF6F00
1345
+ }
1346
+ ]
1347
+ },
1348
+ {
1349
+ color: "Orange",
1350
+ variations: [
1351
+ {
1352
+ weight: 50,
1353
+ hex: 0xFFF3E0
1354
+ },
1355
+ {
1356
+ weight: 100,
1357
+ hex: 0xFFE0B2
1358
+ },
1359
+ {
1360
+ weight: 200,
1361
+ hex: 0xFFCC80
1362
+ },
1363
+ {
1364
+ weight: 300,
1365
+ hex: 0xFFB74D
1366
+ },
1367
+ {
1368
+ weight: 400,
1369
+ hex: 0xFFA726
1370
+ },
1371
+ {
1372
+ weight: 500,
1373
+ hex: 0xFF9800
1374
+ },
1375
+ {
1376
+ weight: 600,
1377
+ hex: 0xFB8C00
1378
+ },
1379
+ {
1380
+ weight: 700,
1381
+ hex: 0xF57C00
1382
+ },
1383
+ {
1384
+ weight: 800,
1385
+ hex: 0xEF6C00
1386
+ },
1387
+ {
1388
+ weight: 900,
1389
+ hex: 0xE65100
1390
+ }
1391
+ ]
1392
+ },
1393
+ {
1394
+ color: "Deep Orange",
1395
+ variations: [
1396
+ {
1397
+ weight: 50,
1398
+ hex: 0xFBE9E7
1399
+ },
1400
+ {
1401
+ weight: 100,
1402
+ hex: 0xFFCCBC
1403
+ },
1404
+ {
1405
+ weight: 200,
1406
+ hex: 0xFFAB91
1407
+ },
1408
+ {
1409
+ weight: 300,
1410
+ hex: 0xFF8A65
1411
+ },
1412
+ {
1413
+ weight: 400,
1414
+ hex: 0xFF7043
1415
+ },
1416
+ {
1417
+ weight: 500,
1418
+ hex: 0xFF5722
1419
+ },
1420
+ {
1421
+ weight: 600,
1422
+ hex: 0xF4511E
1423
+ },
1424
+ {
1425
+ weight: 700,
1426
+ hex: 0xE64A19
1427
+ },
1428
+ {
1429
+ weight: 800,
1430
+ hex: 0xD84315
1431
+ },
1432
+ {
1433
+ weight: 900,
1434
+ hex: 0xBF360C
1435
+ }
1436
+ ]
1437
+ },
1438
+ {
1439
+ color: "Brown",
1440
+ variations: [
1441
+ {
1442
+ weight: 50,
1443
+ hex: 0xEFEBE9
1444
+ },
1445
+ {
1446
+ weight: 100,
1447
+ hex: 0xD7CCC8
1448
+ },
1449
+ {
1450
+ weight: 200,
1451
+ hex: 0xBCAAA4
1452
+ },
1453
+ {
1454
+ weight: 300,
1455
+ hex: 0xA1887F
1456
+ },
1457
+ {
1458
+ weight: 400,
1459
+ hex: 0x8D6E63
1460
+ },
1461
+ {
1462
+ weight: 500,
1463
+ hex: 0x795548
1464
+ },
1465
+ {
1466
+ weight: 600,
1467
+ hex: 0x6D4C41
1468
+ },
1469
+ {
1470
+ weight: 700,
1471
+ hex: 0x5D4037
1472
+ },
1473
+ {
1474
+ weight: 800,
1475
+ hex: 0x4E342E
1476
+ },
1477
+ {
1478
+ weight: 900,
1479
+ hex: 0x3E2723
1480
+ }
1481
+ ]
1482
+ },
1483
+ {
1484
+ color: "Grey",
1485
+ variations: [
1486
+ {
1487
+ weight: 50,
1488
+ hex: 0xFAFAFA
1489
+ },
1490
+ {
1491
+ weight: 100,
1492
+ hex: 0xF5F5F5
1493
+ },
1494
+ {
1495
+ weight: 200,
1496
+ hex: 0xEEEEEE
1497
+ },
1498
+ {
1499
+ weight: 300,
1500
+ hex: 0xE0E0E0
1501
+ },
1502
+ {
1503
+ weight: 400,
1504
+ hex: 0xBDBDBD
1505
+ },
1506
+ {
1507
+ weight: 500,
1508
+ hex: 0x9E9E9E
1509
+ },
1510
+ {
1511
+ weight: 600,
1512
+ hex: 0x757575
1513
+ },
1514
+ {
1515
+ weight: 700,
1516
+ hex: 0x616161
1517
+ },
1518
+ {
1519
+ weight: 800,
1520
+ hex: 0x424242
1521
+ },
1522
+ {
1523
+ weight: 900,
1524
+ hex: 0x212121
1525
+ }
1526
+ ]
1527
+ },
1528
+ {
1529
+ color: "Blue Grey",
1530
+ variations: [
1531
+ {
1532
+ weight: 50,
1533
+ hex: 0xECEFF1
1534
+ },
1535
+ {
1536
+ weight: 100,
1537
+ hex: 0xCFD8DC
1538
+ },
1539
+ {
1540
+ weight: 200,
1541
+ hex: 0xB0BEC5
1542
+ },
1543
+ {
1544
+ weight: 300,
1545
+ hex: 0x90A4AE
1546
+ },
1547
+ {
1548
+ weight: 400,
1549
+ hex: 0x78909C
1550
+ },
1551
+ {
1552
+ weight: 500,
1553
+ hex: 0x607D8B
1554
+ },
1555
+ {
1556
+ weight: 600,
1557
+ hex: 0x546E7A
1558
+ },
1559
+ {
1560
+ weight: 700,
1561
+ hex: 0x455A64
1562
+ },
1563
+ {
1564
+ weight: 800,
1565
+ hex: 0x37474F
1566
+ },
1567
+ {
1568
+ weight: 900,
1569
+ hex: 0x263238
1570
+ }
1571
+ ]
1572
+ },
1573
+ {
1574
+ color: "Grey",
1575
+ variations: [
1576
+ {
1577
+ weight: 50,
1578
+ hex: 0xFFFFFF
1579
+ },
1580
+ {
1581
+ weight: 100,
1582
+ hex: 0xe0e0e0
1583
+ },
1584
+ {
1585
+ weight: 200,
1586
+ hex: 0xc4c4c4
1587
+ },
1588
+ {
1589
+ weight: 300,
1590
+ hex: 0xa8a8a8
1591
+ },
1592
+ {
1593
+ weight: 400,
1594
+ hex: 0x8c8c8c
1595
+ },
1596
+ {
1597
+ weight: 500,
1598
+ hex: 0x707070
1599
+ },
1600
+ {
1601
+ weight: 600,
1602
+ hex: 0x545454
1603
+ },
1604
+ {
1605
+ weight: 700,
1606
+ hex: 0x383838
1607
+ },
1608
+ {
1609
+ weight: 800,
1610
+ hex: 0x1c1c1c
1611
+ },
1612
+ {
1613
+ weight: 900,
1614
+ hex: 0x00000
1615
+ }
1616
+ ]
1617
+ }
1618
+ ];