1 | /*
|
---|
2 | The MIT License (MIT)
|
---|
3 |
|
---|
4 | Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
---|
5 |
|
---|
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
|
---|
7 | of this software and associated documentation files (the "Software"), to deal
|
---|
8 | in the Software without restriction, including without limitation the rights
|
---|
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
---|
10 | copies of the Software, and to permit persons to whom the Software is
|
---|
11 | furnished to do so, subject to the following conditions:
|
---|
12 |
|
---|
13 | The above copyright notice and this permission notice shall be included in
|
---|
14 | all copies or substantial portions of the Software.
|
---|
15 |
|
---|
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
---|
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
---|
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
---|
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
---|
22 | THE SOFTWARE.
|
---|
23 |
|
---|
24 | */
|
---|
25 |
|
---|
26 | var styles = {};
|
---|
27 | module['exports'] = styles;
|
---|
28 |
|
---|
29 | var codes = {
|
---|
30 | reset: [0, 0],
|
---|
31 |
|
---|
32 | bold: [1, 22],
|
---|
33 | dim: [2, 22],
|
---|
34 | italic: [3, 23],
|
---|
35 | underline: [4, 24],
|
---|
36 | inverse: [7, 27],
|
---|
37 | hidden: [8, 28],
|
---|
38 | strikethrough: [9, 29],
|
---|
39 |
|
---|
40 | black: [30, 39],
|
---|
41 | red: [31, 39],
|
---|
42 | green: [32, 39],
|
---|
43 | yellow: [33, 39],
|
---|
44 | blue: [34, 39],
|
---|
45 | magenta: [35, 39],
|
---|
46 | cyan: [36, 39],
|
---|
47 | white: [37, 39],
|
---|
48 | gray: [90, 39],
|
---|
49 | grey: [90, 39],
|
---|
50 |
|
---|
51 | brightRed: [91, 39],
|
---|
52 | brightGreen: [92, 39],
|
---|
53 | brightYellow: [93, 39],
|
---|
54 | brightBlue: [94, 39],
|
---|
55 | brightMagenta: [95, 39],
|
---|
56 | brightCyan: [96, 39],
|
---|
57 | brightWhite: [97, 39],
|
---|
58 |
|
---|
59 | bgBlack: [40, 49],
|
---|
60 | bgRed: [41, 49],
|
---|
61 | bgGreen: [42, 49],
|
---|
62 | bgYellow: [43, 49],
|
---|
63 | bgBlue: [44, 49],
|
---|
64 | bgMagenta: [45, 49],
|
---|
65 | bgCyan: [46, 49],
|
---|
66 | bgWhite: [47, 49],
|
---|
67 | bgGray: [100, 49],
|
---|
68 | bgGrey: [100, 49],
|
---|
69 |
|
---|
70 | bgBrightRed: [101, 49],
|
---|
71 | bgBrightGreen: [102, 49],
|
---|
72 | bgBrightYellow: [103, 49],
|
---|
73 | bgBrightBlue: [104, 49],
|
---|
74 | bgBrightMagenta: [105, 49],
|
---|
75 | bgBrightCyan: [106, 49],
|
---|
76 | bgBrightWhite: [107, 49],
|
---|
77 |
|
---|
78 | // legacy styles for colors pre v1.0.0
|
---|
79 | blackBG: [40, 49],
|
---|
80 | redBG: [41, 49],
|
---|
81 | greenBG: [42, 49],
|
---|
82 | yellowBG: [43, 49],
|
---|
83 | blueBG: [44, 49],
|
---|
84 | magentaBG: [45, 49],
|
---|
85 | cyanBG: [46, 49],
|
---|
86 | whiteBG: [47, 49],
|
---|
87 |
|
---|
88 | };
|
---|
89 |
|
---|
90 | Object.keys(codes).forEach(function(key) {
|
---|
91 | var val = codes[key];
|
---|
92 | var style = styles[key] = [];
|
---|
93 | style.open = '\u001b[' + val[0] + 'm';
|
---|
94 | style.close = '\u001b[' + val[1] + 'm';
|
---|
95 | });
|
---|