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
|
// Generated by CoffeeScript 1.9.3
var codes, styles;
module.exports = styles = {};
styles.codes = codes = {
'none': 0,
'black': 30,
'red': 31,
'green': 32,
'yellow': 33,
'blue': 34,
'magenta': 35,
'cyan': 36,
'white': 37,
'grey': 90,
'bright-red': 91,
'bright-green': 92,
'bright-yellow': 93,
'bright-blue': 94,
'bright-magenta': 95,
'bright-cyan': 96,
'bright-white': 97,
'bg-black': 40,
'bg-red': 41,
'bg-green': 42,
'bg-yellow': 43,
'bg-blue': 44,
'bg-magenta': 45,
'bg-cyan': 46,
'bg-white': 47,
'bg-grey': 100,
'bg-bright-red': 101,
'bg-bright-green': 102,
'bg-bright-yellow': 103,
'bg-bright-blue': 104,
'bg-bright-magenta': 105,
'bg-bright-cyan': 106,
'bg-bright-white': 107
};
styles.color = function(str) {
var code;
if (str === 'none') {
return '';
}
code = codes[str];
if (code == null) {
throw Error("Unkown color `" + str + "`");
}
return "\x1b[" + code + "m";
};
styles.bg = function(str) {
var code;
if (str === 'none') {
return '';
}
code = codes['bg-' + str];
if (code == null) {
throw Error("Unkown bg color `" + str + "`");
}
return "\x1B[" + code + "m";
};
styles.none = function(str) {
return "\x1B[" + codes.none + "m";
};
|