|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Options(data) { |
|
this.style = data.style; |
|
this.color = data.color; |
|
this.size = data.size; |
|
this.phantom = data.phantom; |
|
this.font = data.font; |
|
|
|
if (data.parentStyle === undefined) { |
|
this.parentStyle = data.style; |
|
} else { |
|
this.parentStyle = data.parentStyle; |
|
} |
|
|
|
if (data.parentSize === undefined) { |
|
this.parentSize = data.size; |
|
} else { |
|
this.parentSize = data.parentSize; |
|
} |
|
} |
|
|
|
|
|
|
|
|
|
|
|
Options.prototype.extend = function(extension) { |
|
var data = { |
|
style: this.style, |
|
size: this.size, |
|
color: this.color, |
|
parentStyle: this.style, |
|
parentSize: this.size, |
|
phantom: this.phantom, |
|
font: this.font, |
|
}; |
|
|
|
for (var key in extension) { |
|
if (extension.hasOwnProperty(key)) { |
|
data[key] = extension[key]; |
|
} |
|
} |
|
|
|
return new Options(data); |
|
}; |
|
|
|
|
|
|
|
|
|
Options.prototype.withStyle = function(style) { |
|
return this.extend({ |
|
style: style, |
|
}); |
|
}; |
|
|
|
|
|
|
|
|
|
Options.prototype.withSize = function(size) { |
|
return this.extend({ |
|
size: size, |
|
}); |
|
}; |
|
|
|
|
|
|
|
|
|
Options.prototype.withColor = function(color) { |
|
return this.extend({ |
|
color: color, |
|
}); |
|
}; |
|
|
|
|
|
|
|
|
|
Options.prototype.withPhantom = function() { |
|
return this.extend({ |
|
phantom: true, |
|
}); |
|
}; |
|
|
|
|
|
|
|
|
|
Options.prototype.withFont = function(font) { |
|
return this.extend({ |
|
font: font, |
|
}); |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
Options.prototype.reset = function() { |
|
return this.extend({}); |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var colorMap = { |
|
"katex-blue": "#6495ed", |
|
"katex-orange": "#ffa500", |
|
"katex-pink": "#ff00af", |
|
"katex-red": "#df0030", |
|
"katex-green": "#28ae7b", |
|
"katex-gray": "gray", |
|
"katex-purple": "#9d38bd", |
|
"katex-blueA": "#c7e9f1", |
|
"katex-blueB": "#9cdceb", |
|
"katex-blueC": "#58c4dd", |
|
"katex-blueD": "#29abca", |
|
"katex-blueE": "#1c758a", |
|
"katex-tealA": "#acead7", |
|
"katex-tealB": "#76ddc0", |
|
"katex-tealC": "#5cd0b3", |
|
"katex-tealD": "#55c1a7", |
|
"katex-tealE": "#49a88f", |
|
"katex-greenA": "#c9e2ae", |
|
"katex-greenB": "#a6cf8c", |
|
"katex-greenC": "#83c167", |
|
"katex-greenD": "#77b05d", |
|
"katex-greenE": "#699c52", |
|
"katex-goldA": "#f7c797", |
|
"katex-goldB": "#f9b775", |
|
"katex-goldC": "#f0ac5f", |
|
"katex-goldD": "#e1a158", |
|
"katex-goldE": "#c78d46", |
|
"katex-redA": "#f7a1a3", |
|
"katex-redB": "#ff8080", |
|
"katex-redC": "#fc6255", |
|
"katex-redD": "#e65a4c", |
|
"katex-redE": "#cf5044", |
|
"katex-maroonA": "#ecabc1", |
|
"katex-maroonB": "#ec92ab", |
|
"katex-maroonC": "#c55f73", |
|
"katex-maroonD": "#a24d61", |
|
"katex-maroonE": "#94424f", |
|
"katex-purpleA": "#caa3e8", |
|
"katex-purpleB": "#b189c6", |
|
"katex-purpleC": "#9a72ac", |
|
"katex-purpleD": "#715582", |
|
"katex-purpleE": "#644172", |
|
"katex-mintA": "#f5f9e8", |
|
"katex-mintB": "#edf2df", |
|
"katex-mintC": "#e0e5cc", |
|
"katex-grayA": "#fdfdfd", |
|
"katex-grayB": "#f7f7f7", |
|
"katex-grayC": "#eeeeee", |
|
"katex-grayD": "#dddddd", |
|
"katex-grayE": "#cccccc", |
|
"katex-grayF": "#aaaaaa", |
|
"katex-grayG": "#999999", |
|
"katex-grayH": "#555555", |
|
"katex-grayI": "#333333", |
|
"katex-kaBlue": "#314453", |
|
"katex-kaGreen": "#639b24", |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
Options.prototype.getColor = function() { |
|
if (this.phantom) { |
|
return "transparent"; |
|
} else { |
|
return colorMap[this.color] || this.color; |
|
} |
|
}; |
|
|
|
module.exports = Options; |
|
|