Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80669 views
1
/**
2
* Copyright 2013 Facebook, Inc.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
var E = String.fromCharCode(27);
17
18
function wrap(options, text) {
19
return E + '[' + options + 'm' + text + E + '[m';
20
}
21
22
function bold(text) {
23
return wrap('1', text);
24
}
25
26
function underline(text) {
27
return wrap('4', text);
28
}
29
30
function awesome(text) {
31
return wrap('1;4;7;5;42;35', text);
32
}
33
34
var colors = {
35
black: 0,
36
red: 1,
37
green: 2,
38
yellow: 3,
39
blue: 4,
40
magenta: 5,
41
cyan: 6,
42
white: 7
43
};
44
function color(name, text) {
45
return E + '[' + (colors[name] + 30) + 'm' + text + E + '[39m';
46
}
47
48
exports.bold = bold;
49
exports.underline = underline;
50
exports.awesome = awesome;
51
exports.color = color;
52
53