bugfix: color functions / color defs / color selection
This commit is contained in:
parent
bb8a665aa6
commit
61686c559c
2 changed files with 72 additions and 12 deletions
|
|
@ -1,6 +1,6 @@
|
|||
// Generated by CoffeeScript 1.7.1
|
||||
(function() {
|
||||
var Sahli, ansiorascii, arraytocolor, booltoint, colortoarray, colortoname, dec2hex, dumpjson, hex2dec, inttobool, loadsahli, newsahli, resolvefiletype, statustobool;
|
||||
var Sahli, ansiorascii, arraytocolor, booltoint, colorindex, colortoarray, colortoname, dec2hex, dumpjson, hex2dec, inttobool, loadsahli, newsahli, resolvefiletype, statustobool;
|
||||
|
||||
$(function() {
|
||||
return $("h1").hide().slideDown(500);
|
||||
|
|
@ -199,6 +199,7 @@
|
|||
};
|
||||
|
||||
Sahli.prototype.editline = function(data, pos) {
|
||||
var bcol, fcol;
|
||||
$("#formica").dialog({
|
||||
width: '800',
|
||||
modal: false,
|
||||
|
|
@ -228,6 +229,8 @@
|
|||
]
|
||||
});
|
||||
data.amiga = booltoint(data.amiga);
|
||||
fcol = colortoname(arraytocolor(data.color));
|
||||
bcol = colortoname(arraytocolor(data.bg));
|
||||
$("#entryindex").val(pos);
|
||||
$("#entryname").val(data.name);
|
||||
$("#entryauthor").val(data.author);
|
||||
|
|
@ -236,8 +239,10 @@
|
|||
$("#entryamiga").val(data.amiga);
|
||||
$("#entryamiga").children()[1].textContent = ansiorascii(data.amiga);
|
||||
$("#entryfont").val(data.font);
|
||||
$("#entrycolor").val(colortoname(arraytocolor(data.color)));
|
||||
$("#entrybg").val(colortoname(arraytocolor(data.bg)));
|
||||
$("#entrycolor").val(fcol);
|
||||
$("#entrycolor").children()[colorindex(fcol)].selected = true;
|
||||
$("#entrybg").val(bcol);
|
||||
$("#entrybg").children()[colorindex(bcol)].selected = true;
|
||||
$("#entrywidth").val(data.width);
|
||||
$("#entryline1").val(data.line1);
|
||||
$("#entryline2").val(data.line2);
|
||||
|
|
@ -334,7 +339,7 @@
|
|||
};
|
||||
|
||||
colortoname = function(color) {
|
||||
var names, x;
|
||||
var bw, colorname, names, ret;
|
||||
names = {
|
||||
"#E0E0E0": "Light Grey",
|
||||
"#A0A0E0": "Light Blue",
|
||||
|
|
@ -342,9 +347,9 @@
|
|||
"#FF0000": "Red",
|
||||
"#FF8000": "Orange",
|
||||
"#FFFF00": "Yellow",
|
||||
"#00f000": "Green",
|
||||
"#00F000": "Green",
|
||||
"#2EFEF7": "Cyan",
|
||||
"#2EFEF7": "Blue",
|
||||
"#002EF7": "Blue",
|
||||
"#0B0B3B": "Navy",
|
||||
"#FF00FF": "Magenta",
|
||||
"#8000FF": "Purple",
|
||||
|
|
@ -354,7 +359,32 @@
|
|||
"#000000": "Black"
|
||||
};
|
||||
color = color.toUpperCase();
|
||||
return x = hex2dec(color.slice(1)) > 8421504 ? "#FFFFFF" : "#000000";
|
||||
colorname = names[color];
|
||||
bw = hex2dec(color.slice(1)) > 8421504 ? 'White' : "Black";
|
||||
return ret = colorname != null ? colorname : bw;
|
||||
};
|
||||
|
||||
colorindex = function(colorname) {
|
||||
var names;
|
||||
names = {
|
||||
"Light Grey": 0,
|
||||
"Light Blue": 1,
|
||||
"Light Green": 2,
|
||||
"Red": 3,
|
||||
"Orange": 4,
|
||||
"Yellow": 5,
|
||||
"Green": 6,
|
||||
"Cyan": 7,
|
||||
"Blue": 8,
|
||||
"Navy": 9,
|
||||
"Magenta": 10,
|
||||
"Purple": 11,
|
||||
"Dark Green": 12,
|
||||
"Dark Grey": 13,
|
||||
"White": 14,
|
||||
"Black": 15
|
||||
};
|
||||
return names[colorname];
|
||||
};
|
||||
|
||||
newsahli = function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue