-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
31 lines (25 loc) · 901 Bytes
/
script.js
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
var ColorGenerator = {
init: function () {
ColorGenerator.refresh();
$('#new').click(function () {
var origin = $('#content .large').first();
origin.clone().appendTo("#content");
ColorGenerator.refresh();
});
},
refresh: function () {
$('.color-picker').colorpicker({color: '#FFFFFF', format: 'rgb'});
$('.color-picker').on('changeColor', function (e) {
var target = $(e.currentTarget).parent().parent();
var text = target.find(".text");
var text2 = target.find(".text2");
var color = e.color.toRGB();
text2.html(color.r+","+color.g+","+color.b);
text.html(e.color.toHex());
target.attr("style", "background-color: "+e.color.toHex()+";");
});
}
};
$(document).ready(function () {
ColorGenerator.init();
});