@@ -46,11 +46,11 @@ <h4><b>by Alberto Pujante</b></h4>
46
46
< div class ="col-md-5 ">
47
47
< input [(colorPicker)] ="color3 "
48
48
[style.background] ="color3 "
49
- [value] ="color3 "
49
+ [value] ="color3 "
50
50
[cpOutputFormat] ="'rgba' "/> < br > < br >
51
51
< input [(colorPicker)] ="color4 "
52
52
[style.background] ="color4 "
53
- [value] ="color4 "
53
+ [value] ="color4 "
54
54
[cpOutputFormat] ="'hsla' "/>
55
55
</ div >
56
56
< div class ="col-md-7 ">
@@ -130,17 +130,39 @@ <h4><b>by Alberto Pujante</b></h4>
130
130
[style.background] ="color8 "
131
131
[value] ="color8 "
132
132
[cpCancelButton] ="true "
133
- [cpCancelButtonClass] = "'btn btn-primary btn-xs cp-cancel-button-class ' "/>
133
+ [cpCancelButtonClass] = "'btn btn-primary btn-xs' "/>
134
134
</ div >
135
135
< div class ="col-md-7 ">
136
- < p > Change cancel button class, default is 'cp-cancel-button-class' and only sets button position,< br >
137
- in this example we are using a bootstrap button:</ p >
136
+ < p > Change cancel button class, in this example we are using a bootstrap button:</ p >
138
137
< pre >
139
138
<input [(colorPicker)]="color"
140
139
[style.background]="color"
141
140
[value]="color"
142
141
[cpCancelButton]="true"
143
- [cpCancelButtonClass]= "'btn btn-primary btn-xs cp-cancel-button-class'"/>
142
+ [cpCancelButtonClass]= "'btn btn-primary btn-xs'"/>
143
+ </ pre >
144
+ </ div >
145
+ </ div >
146
+
147
+ < hr >
148
+ < div class ="row " >
149
+ < div class ="col-md-5 " >
150
+ < input [(colorPicker)] ="color9 "
151
+ [style.background] ="color9 "
152
+ [value] ="color9 "
153
+ [cpOKButton] ="true "
154
+ [cpSaveClickOutside] ="false "
155
+ [cpOKButtonClass] = "'btn btn-primary btn-xs' "/>
156
+ </ div >
157
+ < div class ="col-md-7 ">
158
+ < p > Show OK button:</ p >
159
+ < pre >
160
+ <input [(colorPicker)]="color"
161
+ [style.background]="color"
162
+ [value]="color"
163
+ [cpOKButton]="true"
164
+ [cpSaveClickOutside]="false"
165
+ [cpOKButtonClass]= "'btn btn-primary btn-xs'"/>
144
166
</ pre >
145
167
</ div >
146
168
</ div >
@@ -149,9 +171,9 @@ <h4><b>by Alberto Pujante</b></h4>
149
171
< div class ="row ">
150
172
< div class ="col-md-5 ">
151
173
152
- < input [colorPicker] ="color9 "
153
- (colorPickerChange) ="cmyk=onChangeColor($event);color9 =$event "
154
- [style.background] ="color9 "/>
174
+ < input [colorPicker] ="color10 "
175
+ (colorPickerChange) ="cmyk=onChangeColor($event);color10 =$event "
176
+ [style.background] ="color10 "/>
155
177
156
178
< div class ="clearfix "> </ div >
157
179
@@ -194,48 +216,21 @@ <h4><b>by Alberto Pujante</b></h4>
194
216
< hr >
195
217
< div class ="row ">
196
218
< div class ="col-md-5 ">
197
- < input [(colorPicker)] ="color10 " [style.background] ="color10 " [cpPresetColors] ="['#fff', '#000'] "/>
219
+ < input [(colorPicker)] ="color11 "
220
+ [style.background] ="color11 "
221
+ [cpPresetColors] ="['#fff', '#000', '#2889e9', '#e920e9', '#fff500', 'rgb(236,64,64)'] "/>
198
222
</ div >
199
223
< div class ="col-md-7 ">
200
224
< p > With preset colors:</ p >
201
225
< pre >
202
226
<input [(colorPicker)]="color"
203
227
[style.background]="color"
204
- [cpPresetColors]="['#fff', '#000']"/>
228
+ [cpPresetColors]="['#fff', '#000', '#2889e9', '#e920e9', '#fff500', 'rgb(236,64,64)' ]"/>
205
229
</ pre >
206
230
</ div >
207
231
</ div >
208
232
209
233
< hr >
210
- < div class ="row ">
211
- < div id ="color-comparator " class ="col-md-5 ">
212
- < button (click) ="toggle=true;lastColor=color11 "
213
- [style.background] ="lastColor "
214
- #ignoredElement > </ button >
215
- < input [(colorPicker)] ="color11 "
216
- [(cpToggle)] ="toggle "
217
- [style.background] ="color11 "
218
- [cpIgnoredElements] ="[ignoredElement] "/>
219
- < div class ="clearfix "> </ div >
220
- < br >
221
- < div > < b > Toggle status: {{toggle}}</ b > </ div >
222
- </ div >
223
- < div class ="col-md-7 ">
224
- < p > Control color picker dialog with cpToggle:</ p >
225
- < pre >
226
- <button (click)="toggle=true;lastColor=color"
227
- [style.background]="lastColor"
228
- #ignoredElement></button>
229
-
230
- <input [(colorPicker)]="color"
231
- [(cpToggle)]="toggle"
232
- [style.background]="color"
233
- [cpIgnoredElements]="[ignoredElement]"/>
234
- </ pre >
235
- </ div >
236
- </ div >
237
-
238
- < hr >
239
234
< div class ="row ">
240
235
< div class ="col-md-5 ">
241
236
< input #ignoredInput [(colorPicker)] ="color12 "
@@ -261,6 +256,106 @@ <h4><b>by Alberto Pujante</b></h4>
261
256
</ pre >
262
257
</ div >
263
258
</ div >
259
+
260
+ < hr >
261
+ < div class ="row ">
262
+ < div class ="col-md-5 ">
263
+ < input [(colorPicker)] ="color13 "
264
+ [style.background] ="color13 "
265
+ [cpAlphaChannel] ="'disabled' "
266
+ [value] ="color13 "/>
267
+ < br >
268
+ < input [(colorPicker)] ="color14 "
269
+ [style.background] ="color14 "
270
+ [cpAlphaChannel] ="'hex8' "
271
+ [cpOutputFormat] ="'rgba' "
272
+ [value] ="color14 "/>
273
+ < br >
274
+ < input [colorPicker] ="color15 "
275
+ (colorPickerChange) ="rgbaText=onChangeColorHex8($event);color15=$event "
276
+ [style.background] ="rgbaText "
277
+ [cpAlphaChannel] ="'hex8' "
278
+ [cpOutputFormat] ="'hex' "
279
+ [value] ="color15 "/>
280
+ </ div >
281
+ < div class ="col-md-7 ">
282
+ < p > Change alpha channel behaviour:</ p >
283
+ < pre >
284
+ <input [(colorPicker)]="color"
285
+ [style.background]="color"
286
+ [cpAlphaChannel]="'disabled'"
287
+ [value]="color"/>
288
+
289
+ <input [(colorPicker)]="color"
290
+ [style.background]="color"
291
+ [cpAlphaChannel]="'hex8'"
292
+ [cpOutputFormat]="'rgba'"
293
+ [value]="color"/>
294
+
295
+ <input [colorPicker]="color"
296
+ (colorPickerChange)="rgbaText=onChangeColorHex8($event);color=$event"
297
+ [style.background]="rgbaText"
298
+ [cpAlphaChannel]="'hex8'"
299
+ [value]="color"/>
300
+ </ pre >
301
+ </ div >
302
+ </ div >
303
+
304
+ < hr >
305
+ < div class ="row " style ="height: 320px ">
306
+
307
+ < div class ="col-md-3 ">
308
+ < span [(colorPicker)] ="arrayColors[selectedColor] "
309
+ [cpDialogDisplay] ="'inline' "
310
+ [style.background] ="arrayColors[selectedColor] "
311
+ [cpCancelButtonClass] = "'btn btn-primary btn-xs' "
312
+ [cpCancelButton] ="true "
313
+ [cpToggle] ="true ">
314
+ </ span >
315
+ </ div >
316
+
317
+ < div class ="col-md-2 ">
318
+
319
+ < div class ="array-colors-element "
320
+ [style.background] ="arrayColors['color'] "
321
+ (click) ="selectedColor='color' "> </ div >
322
+
323
+ < div class ="array-colors-element "
324
+ [style.background] ="arrayColors['color2'] "
325
+ (click) ="selectedColor='color2' "> </ div >
326
+
327
+ < div class ="array-colors-element "
328
+ [style.background] ="arrayColors['color3'] "
329
+ (click) ="selectedColor='color3' "> </ div >
330
+
331
+ < div class ="array-colors-element "
332
+ [style.background] ="arrayColors['color4'] "
333
+ (click) ="selectedColor='color4' "> </ div >
334
+
335
+ < div class ="array-colors-element "
336
+ [style.background] ="arrayColors['color5'] "
337
+ (click) ="selectedColor='color5' "> </ div >
338
+
339
+ </ div >
340
+
341
+ < div class ="col-md-7 ">
342
+ < p > Show the dialog permanently: </ p >
343
+ < pre >
344
+ <span [(colorPicker)]="arrayColors[selectedColor]"
345
+ [cpType]="'fixed'"
346
+ [style.background]="arrayColors[selectedColor]"
347
+ [cpToggle]="true"></span>
348
+
349
+ <div [style.background]="arrayColors['color']"
350
+ (click)="selectedColor='color'"></div>
351
+
352
+ <div [style.background]="arrayColors['color2']"
353
+ (click)="selectedColor='color2'"></div>
354
+
355
+ ...
356
+ </ pre >
357
+ </ div >
358
+ </ div >
264
359
265
360
< hr >
266
361
< br >
@@ -300,13 +395,6 @@ <h4><b>by Alberto Pujante</b></h4>
300
395
Dialog position is calculated relative to the dialog (false) or relative to the dialog arrow (true).
301
396
</ td >
302
397
</ tr >
303
- < tr >
304
- < td > cpCancelButton</ td >
305
- < td >
306
- < b > false</ b > , true< br >
307
- When the user cancels the initial color is restored.
308
- </ td >
309
- </ tr >
310
398
< tr >
311
399
< td > cpWidth</ td >
312
400
< td >
@@ -322,17 +410,36 @@ <h4><b>by Alberto Pujante</b></h4>
322
410
</ td >
323
411
</ tr >
324
412
< tr >
325
- < td > cpCancelButtonClass</ td >
413
+ < td > cpSaveClickOutside</ td >
414
+ < td >
415
+ < b > true</ b > , false< br >
416
+ If true the initial color is restored when user clicks outside.
417
+ </ td >
418
+ </ tr >
419
+ < tr >
420
+ < td > cpOKButton</ td >
326
421
< td >
327
- < b > 'cancel-button-class'</ b > < br >
328
- Default class only sets button position:
329
- < pre >
330
- .cp-cancel-button-class{
331
- position:absolute;
332
- top: 275px;
333
- left: 161px;
334
- }
335
- </ pre >
422
+ < b > false</ b > , true< br >
423
+ Shows the Ok button. Saves the selected color.
424
+ </ td >
425
+ </ tr >
426
+ < tr >
427
+ < td > cpOKButtonText</ td >
428
+ < td >
429
+ < b > 'OK'</ b >
430
+ </ td >
431
+ </ tr >
432
+ < tr >
433
+ < td > cpOKButtonClass</ td >
434
+ < td >
435
+ Class to customize the OK button.
436
+ </ td >
437
+ </ tr >
438
+ < tr >
439
+ < td > cpCancelButton</ td >
440
+ < td >
441
+ < b > false</ b > , true< br >
442
+ Shows the Cancel button. Cancel the selected color.
336
443
</ td >
337
444
</ tr >
338
445
< tr >
@@ -341,6 +448,12 @@ <h4><b>by Alberto Pujante</b></h4>
341
448
< b > 'Cancel'</ b >
342
449
</ td >
343
450
</ tr >
451
+ < tr >
452
+ < td > cpCancelButtonClass</ td >
453
+ < td >
454
+ Class to customize the Cancel button.
455
+ </ td >
456
+ </ tr >
344
457
< tr >
345
458
< td > cpFallbackColor</ td >
346
459
< td >
@@ -376,6 +489,23 @@ <h4><b>by Alberto Pujante</b></h4>
376
489
Array of HTML elements that will be ignored by the color picker when they are clicked.
377
490
</ td >
378
491
</ tr >
492
+ < tr >
493
+ < td > cpDialogDisplay</ td >
494
+ < td >
495
+ < b > 'popup'</ b > , 'inline'< br >
496
+ popup: dialog is showed when user clicks in the directive.< br >
497
+ inline: dialog is showed permanently. You can show/hide the dialog with cpToggle.
498
+ </ td >
499
+ </ tr >
500
+ < tr >
501
+ < td > cpAlphaChannel</ td >
502
+ < td >
503
+ < b > 'hex6'</ b > , 'hex8', 'disabled'< br >
504
+ hex6: alpha channel is not allowed in hexadecimal values.< br >
505
+ hex8: alpha channel is allowed in hexadecimal values.< br >
506
+ disabled: alpha channel disabled.< br >
507
+ </ td >
508
+ </ tr >
379
509
</ tbody >
380
510
</ table >
381
511
</ div >
@@ -384,4 +514,4 @@ <h4><b>by Alberto Pujante</b></h4>
384
514
< footer class ="footer "> © Alberto Pujante 2016 | < a href ="https://github.com/Alberplz/angular2-color-picker "> Angular2 Color Picker</ a > </ footer >
385
515
< br >
386
516
387
- </ div >
517
+ </ div >
0 commit comments