1 # ansistyles [![build status](https://secure.travis-ci.org/thlorenz/ansistyles.png)](http://next.travis-ci.org/thlorenz/ansistyles)
3 Functions that surround a string with ansistyle codes so it prints in style.
5 In case you need colors, like `red`, have a look at [ansicolors](https://github.com/thlorenz/ansicolors).
14 var styles = require('ansistyles');
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
21 ## Combining with ansicolors
23 Get the ansicolors module:
25 npm install ansicolors
28 var styles = require('ansistyles')
29 , colors = require('ansicolors');
32 // prints hello world underlined in blue on a green background
33 colors.bgGreen(colors.blue(styles.underline('hello world')))
39 Look at the [tests](https://github.com/thlorenz/ansistyles/blob/master/test/ansistyles.js) to see more examples and/or run them via:
41 npm explore ansistyles && npm test
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.
48 I included them for completeness, but didn't show them in the examples because they seem to have no effect.
52 A style reset function is also included, please note however that this is not nestable.
54 Therefore the below only underlines `hell` only, but not `world`.
57 console.log(styles.underline('hell' + styles.reset('o') + ' world'));
60 It is essentially the same as:
63 console.log(styles.underline('hell') + styles.reset('') + 'o world');
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).