Console
Better console :
- Easy colors
- Auto timestamp
Installation
npm i @mathieuc/console
Then:
require('@mathieuc/console')(
'§',
true,
CORR,
'94',
);
console.log(...);
console.info(...);
console.warn(...);
console.error(...);
Console colors
This lib allows you to use any character as an alias to \x1b[Xm
.
Example
If you use '§' as alias,
console.log('\x1b[31mRed \x1b[32mGreen \x1b[33mYellow');
becomes
console.log('§31Red $32Green §33Yellow');
There are two parameters (digits) :
- First is type: it can be 3, 4, 9, 10 or nothing
- Second is color, between 0 and 7
Types :
X
: Formatting
0
: Reset1
: Bold3
: Italic7
: Reverse8
: Hidden
3X
: Colors4X
: Background9X
: Colors (light)10X
: Background (light)
Colors : (3X, 4X, 9X, 10X)
0
: Black1
: Red2
: Green3
: Yellow4
: Blue5
: Magenta6
: Cyan7
: White
Combinations
If you use §
as alias, you can combine formatting with font color and background color.
§3§44§30
=> Italic (§3
) + Black font (§30
) + Blue background (§44
)§3§104§30
=> Italic (§3
) + Black font (§30
) + Light blue background (§104
)
Problems
If you have errors in console or unwanted behavior, just reload the page.
If the problem persists, please create an issue here.