shtml
Style shell output in an html-like fashion. This library draws inspiration from chx but differs because it uses JavaScript template literals.
Requires no transpilation or babelscript.
Installation
npm install --save shtml
Usage
const shtml = require('shtml')
console.log(shtml`
<ul>
<li>Item <red>A</red></li>
<li>Item <rainbow>B</rainbow></li>
</ul>
`)
console.log(shtml`
<span>
<rainbow>Hello, world!</rainbow><br>
<underline>This is pretty neat.</underline>
</span>
`)
Supported tags
Tag | Usage | Description |
---|---|---|
<p> |
<p>...</p> |
Wrapper for text, adds a new line to the end |
<br> |
<br> |
Adds a newline |
<hr> |
<hr> |
Adds a horizontal rule |
<ul> |
<ul><li>Item A</li><li>Item B</li></ul> |
Adds an unordered list with bullet points |
<color> |
<red>...</red> |
Color the text, see the supported colors below |
<bgcolor> |
<bgcyan>...</bgcyan> |
Color the background of text, see the supported colors below |
<rainbow> |
<rainbow>...</rainbow> |
Get rainbow colored text |
Colors
In order to color console text, shtml
uses chalk
.
The following colors are supported:
- black
- red
- green
- yellow
- blue
- magenta
- cyan
- white
- gray
License
MIT
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Crafted with <3 by John Otander (@4lpine).
This package was initially generated with yeoman and the p generator.