This time I will share jQuery Plugin and tutorial about Photoshop-style Full Featured Color Picker For jQuery – wcolpick, hope it will help you in programming stack.
wcolpick(Colpick REMIX) is a jQuery plugin to create responsive, cross-browser, touch-enabled, Photo-like RGB/HEX/HSB/HSL color pickers for your web application.
It can be used inline or as a popup bound to any clickable element (e.g. input fields and buttons).
Based on the jQuery Colpick color picker plugin. Dual licensed under GPL v3.0 and MIT licenses.
How to use it:
1. Load the following stylesheets in the header of the html document.
1 |
/*Loading main layout variant (standard)*/ |
2 |
@import 'css/layouts.css'; |
4 |
/*Loading alternative layout variants*/ |
5 |
@import 'css/layouts-s.css'; |
6 |
@import 'css/layouts-xl.css'; |
8 |
/*Loading color schemes*/ |
9 |
@import 'css/color-schemes.css'; |
2. Load JQuery library and the jQuery Colpick REMIX plugin’s script at the end of the document.
1 |
< script src = "//code.jquery.com/jquery.min.js" ></ script > |
2 |
< script src = "colpick-remix/colpickRmx.js" ></ script > |
3. Create an inline color picker on the web page.
1 |
< div id = "example1" ></ div > |
1 |
$( '#example1' ).loads(); |
4. Attach the color picker to your text field.
1 |
< input type = "text" id = "example2" readonly></ input > |
01 |
$( '#example2' ).loads({ |
02 |
onSubmit: function (ev) { |
03 |
$(ev.el).css( 'border-color' , '#' + ev.hex); |
04 |
$(ev.el).val( "#" + ev.hex); |
07 |
onHide: function (ev) { |
08 |
var color = $(ev.el).getColor( "hex" , true ); |
09 |
$(ev.el).setColor(color, false ); |
5. Attach the color picker to an element you specify.
1 |
< button id = "example3" ></ button > |
01 |
$( '#example3' ).loads({ |
07 |
onLoaded: function (ev) { |
08 |
var hex = $(ev.el).getColor( "hex" , true ); |
09 |
$(ev.el).css( 'background-color' , '#' + hex); |
11 |
onHide: function (ev) { |
12 |
var hex = $(ev.el).getColor( "hex" , true ); |
13 |
$(ev.el).css( 'background-color' , '#' + hex); |
14 |
$(ev.el).setColor(hex, false ); |
16 |
onChange: function (ev) { |
17 |
$(ev.el).css( 'background-color' , '#' + ev.hex); |
19 |
onSubmit: function (ev) { |
6. All possible options to customize the color picker plugin.
01 |
$( '#element' ).newColpick({ |
04 |
arrowsColor: 'default' , |
05 |
backgroundColor: 'default' , |
07 |
borderColor: 'default' , |
08 |
checkersColor: 'default' , |
09 |
color: {h:0, s:0, b:20, a:1}, |
11 |
colorScheme: 'light-full' , |
12 |
colorSelOutline: true , |
17 |
fieldsBackground: 'default' , |
24 |
readonlyFields: false , |
25 |
readonlyHexField: false , |
27 |
submitBackground: 'default' , |
28 |
submitColor: 'default' , |
7. Event handlers.
01 |
$( '#element' ).newColpick({ |