]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/ansicolors/README.md
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / ansicolors / README.md
1 # ansicolors [![build status](https://secure.travis-ci.org/thlorenz/ansicolors.png)](http://next.travis-ci.org/thlorenz/ansicolors)
2
3 Functions that surround a string with ansicolor codes so it prints in color.
4
5 In case you need styles, like `bold`, have a look at [ansistyles](https://github.com/thlorenz/ansistyles).
6
7 ## Installation
8
9     npm install ansicolors
10
11 ## Usage
12
13 ```js
14 var colors = require('ansicolors');
15
16 // foreground colors
17 var redHerring = colors.red('herring');
18 var blueMoon = colors.blue('moon');
19 var brighBlueMoon = colors.brightBlue('moon');
20
21 console.log(redHerring);      // this will print 'herring' in red
22 console.log(blueMoon);        // this 'moon' in blue
23 console.log(brightBlueMoon);  // I think you got the idea
24
25 // background colors
26 console.log(colors.bgYellow('printed on yellow background'));
27 console.log(colors.bgBrightBlue('printed on bright blue background'));
28
29 // mixing background and foreground colors
30 // below two lines have same result (order in which bg and fg are combined doesn't matter)
31 console.log(colors.bgYellow(colors.blue('printed on yellow background in blue')));
32 console.log(colors.blue(colors.bgYellow('printed on yellow background in blue')));
33 ```
34
35 ## Advanced API
36
37 **ansicolors** allows you to access opening and closing escape sequences separately.
38
39 ```js
40 var colors = require('ansicolors');
41
42 function inspect(obj, depth) {
43   return require('util').inspect(obj, false, depth || 5, true);
44 }
45
46 console.log('open blue', inspect(colors.open.blue));
47 console.log('close bgBlack', inspect(colors.close.bgBlack));
48
49 // => open blue '\u001b[34m'
50 //    close bgBlack '\u001b[49m'
51 ```
52
53 ## Tests
54
55 Look at the [tests](https://github.com/thlorenz/ansicolors/blob/master/test/ansicolors.js) to see more examples and/or run them via: 
56
57     npm explore ansicolors && npm test
58
59 ## Alternatives
60
61 **ansicolors** tries to meet simple use cases with a very simple API. However, if you need a more powerful ansi formatting tool, 
62 I'd suggest to look at the [features](https://github.com/TooTallNate/ansi.js#features) of the [ansi module](https://github.com/TooTallNate/ansi.js).