forked from evoluteur/colorpicker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
214 lines (181 loc) · 6.22 KB
/
index.html
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>evol-colorpicker</title>
<meta charset="utf-8">
<link id="jquiCSS" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/themes/ui-lightness/jquery-ui.css" type="text/css" media="all">
<link href="css/demo.css" rel="stylesheet" />
<link href="css/evol-colorpicker.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.min.js" type="text/javascript"></script>
<script src="js/evol-colorpicker.min.js" type="text/javascript"></script>
</head>
<body>
<h1 id="title">evol-colorpicker demo</h1>
<h2 id="github">
<a href="https://github.com/evoluteur/colorpicker">GitHub</a>
</h2>
<p><strong>evol-colorpicker</strong> (currently v3.2.6) is a web color picker which looks like the one in Microsoft Office 2010.
It can be used inline or as a popup bound to a text box.
It is a full jQuery UI widget, supporting various configurations and themes.
</p>
<div style="padding:2px 40px">
<p>Themes:
<a href="#" class="css sel">ui-lightness</a> -
<a href="#" class="css">ui-darkness</a> -
<a href="#" class="css">redmond</a> -
<a href="#" class="css">sunny</a> -
<a href="#" class="css">le-frog</a>
</p>
<div class="demoPanel">
Inline (using a DIV tag):<br/><br/>
<div id="cpDiv"></div>
<br/>
<div class="demo-links">
<a href="#" id="getVal2">Get Value</a>
<a href="#" id="setVal2">Set Value</a><br/>
<a href="#" id="enable2">Enable</a>
<a href="#" id="disable2">Disable</a>
<a href="#" id="destroy2">Destroy</a><br/><br/>
</div>
</div>
<div class="demoPanel">
Inline with "web" default palette:<br/><br/>
<div id="cpDiv2"></div>
</div>
<div class="demoPanel" style="width:130px">
Using "showOn" option:<br/><br/>
button
<input id="cpButton" value="#92cddc" />
focus
<input id="cpFocus" value="#dbeef3" />
both
<input id="cpBoth" value="#31859b" />
<a href="#" id="show">link</a>
<input id="cpOther" value="#002060" />
</div>
<div id="cpb" class="demoPanel" style="width:170px">
Event binding:<br/>
change.color and mouseover.color<br/><br/>
<input id="cp1"/><br/>
<div id="tests" class="demo-links">
<a href="#" id="getVal">Get Value</a>
<a href="#" id="setVal">Set Value</a><br/>
<a href="#" id="enable">Enable</a>
<a href="#" id="disable">Disable</a>
<a href="#" id="clear">Clear</a>
<a href="#" id="destroy1">Destroy</a>
</div>
</div>
<div class="demoPanel" style="width:130px">
With transparent color:<br/>
<br/>
<input id="transColor" value="#0000ffff" /><br/>
</div>
<div class="demoPanel" style="width:130px">
Using "hideButton" option:<br/>
<br/>
<input id="hideButton" value="#92cddc" /><br/>
</div>
<div class="demoPanel ui-widget ui-widget-content ui-corner-all" style="width:130px;">
No color indicator on the palette:<br/>
<br/>
<input id="noIndColor" value="#92cddc" /><br/>
</div>
<div class="demoPanel ui-widget ui-widget-content ui-corner-all" style="width:130px;">
In French:<br/>
<br/>
<input id="frenchColor" value="#92cddc" /><br/>
Using the "strings" option you can translate the colorpicker.<br/>
</div>
<div style="clear:both;"></div>
</div>
<script>
$(document).ready(function(){
// Change theme
$('.css').on('click', function(evt){
$('#jquiCSS').attr('href','http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/themes/'+this.innerHTML+'/jquery-ui.css');
$('.css').removeClass('sel');
$(this).addClass('sel');
});
// Events demo
$('#cp1').colorpicker({color:'#8db3e2',
initialHistory: ['#ff0000','#000000','red']
})
.on('change.color', function(evt, color){
$('#cpb').css('background-color',color);
})
.on('mouseover.color', function(evt, color){
if(color){
$('#cpb').css('background-color',color);
}
});
$('#getVal').on('click', function(){
alert('Selected color = "' + $('#cp1').colorpicker("val") + '"');
});
$('#setVal').on('click', function(){
$('#cp1').colorpicker("val",'#31859b');
});
$('#enable').on('click', function(){
$('#cp1').colorpicker("enable");
});
$('#disable').on('click', function(){
$('#cp1').colorpicker("disable");
});
$('#clear').on('click', function(){
var v=$('#cp1').colorpicker("clear") ;
});
$('#destroy1').on('click', function(){
var v=$('#cp1').colorpicker("destroy") ;
});
// Instanciate colorpickers
$('#cpBoth').colorpicker();
$('#cpDiv').colorpicker({color:'#31859b'});
$('#cpDiv2').colorpicker({color:'#31859b', defaultPalette:'web'});
$('#cpFocus').colorpicker({showOn:'focus'});
$('#cpButton').colorpicker({showOn:'button'});
$('#cpOther').colorpicker({showOn:'none'});
$('#show').on('click', function(evt){
evt.stopImmediatePropagation();
$('#cpOther').colorpicker("showPalette");
});
// With transparent color
$('#transColor').colorpicker({
transparentColor: true
});
// With hidden button
$('#hideButton').colorpicker({
hideButton: true
});
// No color indicator
$('#noIndColor').colorpicker({
displayIndicator: false
});
// French colorpicker
$('#frenchColor').colorpicker({
strings: "Couleurs de themes,Couleurs de base,Plus de couleurs,Moins de couleurs,Palette,Historique,Pas encore d'historique."
});
// Inline colorpicker
$('#getVal2').on('click', function(){
alert('Selected color = "' + $('#cpDiv').colorpicker("val") + '"');
});
$('#setVal2').on('click', function(){
$('#cpDiv').colorpicker("val",'#31859b');
});
$('#enable2').on('click', function(){
$('#cpDiv').colorpicker("enable");
});
$('#disable2').on('click', function(){
$('#cpDiv').colorpicker("disable");
});
$('#destroy2').on('click', function(){
$('#cpDiv').colorpicker("destroy");
});
// Fix links
$('a[href="#"]').attr('href', 'javascript:void(0)');
});
</script>
<p><br/><a href="https://github.com/evoluteur/colorpicker/archive/master.zip">Download</a>, documentation, and source code are available at <a href="https://github.com/evoluteur/colorpicker" target="download">GitHub</a> under the <a href="http://github.com/evoluteur/colorpicker/raw/master/LICENSE.md">MIT license</a>.</p>
<br/><br/>
<div class="footer">© 2016 Olivier Giulieri</div>
</body>
</html>