tynt
Version:
A tactile color library for Node.js' console.
72 lines (60 loc) • 1.28 kB
Markdown
# Tynt
### A tactile color library for Node.js' console.
Tynt is very easy to use, here is a quick example:
```javascript
var tynt = require("tynt");
console.log("The blue " + tynt.Blue("Chicken") + " ate a red " + tynt.Red("seed") + ".")
```
## Installation
Using NPM:
```
npm i tynt
```
## List of Colors
Here is a reference of pre-defined colors that you don't need to add yourself.
```javascript
tynt.Reset
tynt.Bright
tynt.Dim
tynt.Underscore
tynt.Blink
tynt.Reverse
tynt.Hidden
tynt.Black
tynt.Red
tynt.Green
tynt.Yellow
tynt.Blue
tynt.Magenta
tynt.Cyan
tynt.White
tynt.BgBlack
tynt.BgRed
tynt.BgGreen
tynt.BgYellow
tynt.BgBlue
tynt.BgMagenta
tynt.BgCyan
tynt.BgWhite
```
## Adding Presets/Prefixes
```javascript
tynt.add("name","John")
console.log("Hello, " + tynt.name("") + ".") // Hello, John.
```
```javascript
tynt.add("err",tynt.Red("Error: "))
console.log(tynt.err("Well this sucks.")) // Error: Well this sucks.
```
## Variables
Tynt has built in variables to help when making Presets/Prefixes.
```javascript
// {text}
tynt.add("Hello","Hello, {text}!")
console.log(tynt.Hello("John")) // Hello, John!
```
```
// Before, without variables (NOT SUPPORTED BY 1.0)
tynt.add("Hello","Hello, ")
console.log(tynt.Hello("James") + "!") // Hello, James!
```