First of all, install the package by using npm
or yarn
by tapping:
npm install console.browser --save
//or
yarn add console.browser
You only need to import the package by destructuring the module :
const { console } = require("console.browser");
console.nor("Hey");
This will return the console object with more colors
If you want to nest colors you can take/add an other variable in the destructuring:
const { console, colors } = require("console.browser");
console.warn(
"Hey",
colors.inverse("Inverse this!"),
colors.rainbow("I'm a rainbow !!")
);
- nor ⇒
Outputs a message to the console Equivalent to console.log but outputs the data in a blue tint to be more visible when logging information
- success ⇒
Outputs a success message to the console
- error ⇒
Outputs an error message to the console When debugging for example in a
try{}catch{}
- warn ⇒
Outputs a warning message to the console with a yellow color
- info ⇒
Outputs an informational message to the console
- rainbow ⇒
Outputs the multicolored data
- zebra ⇒
Outputs the data in black and white
- bold ⇒
Outputs the data in bold
- dim ⇒
Outputs the data in dim
- inverse ⇒
Outputs the inverse of the given data
- italic ⇒
Outputs the data in italic
- underline ⇒
Underlines the data
- allown ⇒
Isolates that given data to be more visible
- newline ⇒
Shows each argument on a new line.
- json ⇒
Shows each argument on a new line in a json format
Equivalent to console.log but outputs the data in a blue tint to be more visible when logging information
Kind: global variable Returns: Data with a blue tinit
Param | Type | Description |
---|---|---|
...args | any |
The data to output |
Outputs a success message to the console
Kind: global variable Returns: Data with green color
Param | Type | Description |
---|---|---|
...args | any |
The data to output |
Example
console.success("I just hacked Nasaaaaaaaaaaa !");
When debugging for example in a try{}catch{}
Kind: global variable Returns: Data with red color
Param | Type | Description |
---|---|---|
...args | any |
The data to output |
Example
console.error("OMG! I just did a stupid error!");
Outputs a warning message to the console with a yellow color
Kind: global variable Returns: Data with yellow color
Param | Type | Description |
---|---|---|
...args | any |
The data to output |
Example
console.warn("The world will end in one week !");
Outputs an informational message to the console
Kind: global variable Returns: Data with dark blue color
Param | Type | Description |
---|---|---|
...args | any |
The data to output |
Example
console.info(
"Did you know that Leonard de Vinci was born in 1452 in Anchiano ?"
);
Outputs the multicolored data
Kind: global variable Returns: Rainbow output
Param | Type | Description |
---|---|---|
...args | any |
The data to output |
Example
console.rainbow(
"The way I see it, if you want the rainbow, you gotta put up with the rain."
);
Outputs the data in black and white
Kind: global variable Returns: Zebra output
Param | Type | Description |
---|---|---|
...args | any |
The data to output |
Example
console.zebra(`Wait am i in savanna ?`);
Outputs the data in bold
Kind: global variable Returns: Bold output
Param | Type | Description |
---|---|---|
...args | any |
The data to output |
Example
console.bold("I'm bold");
Outputs the data in dim
Kind: global variable Returns: Dim output
Param | Type | Description |
---|---|---|
...args | any |
The data to output |
Example
console.dim("I'm a dim output !");
Outputs the inverse of the given data
Kind: global variable Returns: Inverse of the data
Param | Type | Description |
---|---|---|
...args | any |
The data to output |
Example
console.inverse("I'm a inverse output !");
Outputs the data in italic
Kind: global variable Returns: Italic output
Param | Type | Description |
---|---|---|
...args | any |
The data to output |
Example
console.italic("I'm in italic !");
Underlines the data
Kind: global variable Returns: Underlined output
Param | Type | Description |
---|---|---|
...args | any |
The data to output |
Example
console.underline("I'm underlined !");
Isolates that given data to be more visible
Kind: global variable Returns: Isolated output
Param | Type | Description |
---|---|---|
...args | any |
The data to output |
Example
console.allown("This is isolated from the rest of the console");
Shows each argument on a new line.
Kind: global variable Returns: Each argument on a new line
Param | Type | Description |
---|---|---|
...args | any |
The data to output |
Example
console.newline(
"This is on the first line",
"This is on the second line",
"This is on the third line"
);
Shows each argument on a new line in a json format
Kind: global variable Returns: Each argument on a new line
Param | Type | Description |
---|---|---|
...args | any |
The data to output |
Example
console.json(name, surname, username); //equivalent to writing console.log({name}, "\n", {surname}, "\n", {username})