tfunk
Multi-colour console output from Chalk with added awesome.
by @shakyshane & @AydinHassan
Install
npm install tfunk
Usage
Syntax rules:
{
<color>
:
YOUR STRING
}
Example
{blue:This is a blue line}
}
is optional
{blue:This is a blue line
<- Perfectly valid
Usage
var tFunk = ; console // => tFunk terminal colours
Or get a custom compiler with a set prefix:
var compiler = ; console;console; // => [tFunk] tFunk is awesome// => [tFunk] don't you think?
Define your own syntax
You can define your own methods, they receive the string section as the first parameter & have access to the compiler
through this.compile()
keyword.
var compiler = ;
Now you can use warn
anywhere you like.
console; // => WARNING: Could not file your config file...
Examples
Here are some comparisons to chalk, to help you understand how to use tFunk.
Single Colours
// chalkconsole; // tFunkconsole;
Single Colour mid string
// chalkconsole; // tFunckconsole;
Single Colour with end point
// chalkconsole; // tFunkconsole;
Two Colours
// chalkconsole; // tFunkconsole;
Nested Colours
// chalkconsole; //tFunkconsole;
Multiple Nested
// chalkconsole; // tFunkconsole;
Multi line
var multiline = ; var string = ; console;
Escaping when you need curly braces
console;
TODO
- Colours
- Nested Colours
- Custom syntax
- Prefixed compiler
- Make the chain-able API work like this
"{white.bgRed: White text, red BG"
- Offer a way of escaping. Right now, ALL instances of
}
will be lost