]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/ansistyles/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 / ansistyles / README.md
1 # ansistyles [![build status](https://secure.travis-ci.org/thlorenz/ansistyles.png)](http://next.travis-ci.org/thlorenz/ansistyles)
2
3 Functions that surround a string with ansistyle codes so it prints in style.
4
5 In case you need colors, like `red`, have a look at [ansicolors](https://github.com/thlorenz/ansicolors).
6
7 ## Installation
8
9     npm install ansistyles
10
11 ## Usage
12
13 ```js
14 var styles = require('ansistyles');
15
16 console.log(styles.bright('hello world'));    // prints hello world in 'bright' white
17 console.log(styles.underline('hello world')); // prints hello world underlined
18 console.log(styles.inverse('hello world'));   // prints hello world black on white
19 ```
20
21 ## Combining with ansicolors
22
23 Get the ansicolors module:
24
25     npm install ansicolors
26
27 ```js
28 var styles = require('ansistyles')
29   , colors = require('ansicolors');
30
31   console.log(
32     // prints hello world underlined in blue on a green background
33     colors.bgGreen(colors.blue(styles.underline('hello world'))) 
34   );
35 ```
36
37 ## Tests
38
39 Look at the [tests](https://github.com/thlorenz/ansistyles/blob/master/test/ansistyles.js) to see more examples and/or run them via: 
40
41     npm explore ansistyles && npm test
42
43 ## More Styles
44
45 As you can see from [here](https://github.com/thlorenz/ansistyles/blob/master/ansistyles.js#L4-L15), more styles are available,
46 but didn't have any effect on the terminals that I tested on Mac Lion and Ubuntu Linux.
47
48 I included them for completeness, but didn't show them in the examples because they seem to have no effect.
49
50 ### reset
51
52 A style reset function is also included, please note however that this is not nestable.
53
54 Therefore the below only underlines `hell` only, but not `world`.
55
56 ```js
57 console.log(styles.underline('hell' + styles.reset('o') + ' world'));
58 ```
59
60 It is essentially the same as:
61
62 ```js
63 console.log(styles.underline('hell') + styles.reset('') + 'o world');
64 ```
65
66
67
68 ## Alternatives
69
70 **ansistyles** tries to meet simple use cases with a very simple API. However, if you need a more powerful ansi formatting tool, 
71 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).