-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuilder.js
55 lines (44 loc) · 1.23 KB
/
builder.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
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
function builderInit()
{
$("#output").hide();
};
function builderUpdateColors()
{
$("#output").hide();
$("#terminal").css("background", $("#background").val());
$("#terminal").css("color", $("#foreground").val());
for (var i = 0; i < 16; i++) {
$(".color" + i).css("color", $("#color" + i).val());
}
};
function builderDownloadColors()
{
var name = $("#schemename").val();
var xres;
xres = "! Terminal color scheme '" + name + "' built at\n";
xres += "! http://termscheme.eu" + '\n';
xres += name + ".background: " + $("#background").val() + '\n';
xres += name + ".foreground: " + $("#foreground").val() + '\n';
for (var i = 0; i < 16; i++) {
xres += name + ".color" + i + ": " + $("#color" + i).val() + '\n';
}
// Shave off that last line feed character.
xres = xres.substr(0, xres.length - 1);
var out = $("#output");
out.val(xres);
out.show();
out.focus().select();
};
$(document).ready(function() {
var f = $.farbtastic('#picker');
var p = $('#picker');
var selected;
$('input.color').each(function () { f.linkTo(this); }).focus(function() {
if (selected) {
$(selected).removeClass('color-selected');
builderUpdateColors();
}
f.linkTo(this);
$(selected = this).addClass('color-selected');
});
});