https://github.com/simple-works/0console
✒️ Patched console functions with improved output.
https://github.com/simple-works/0console
color console js node node-console nodejs nodejs-console
Last synced: about 1 month ago
JSON representation
✒️ Patched console functions with improved output.
- Host: GitHub
- URL: https://github.com/simple-works/0console
- Owner: simple-works
- License: mit
- Created: 2022-03-06T05:57:37.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-07T02:46:02.000Z (about 4 years ago)
- Last Synced: 2025-10-29T22:57:31.262Z (7 months ago)
- Topics: color, console, js, node, node-console, nodejs, nodejs-console
- Language: JavaScript
- Homepage:
- Size: 420 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ✒️ 0console
[](https://npmjs.org/package/0console)
Simple patched console functions with improved output.

# 📥 Install
```
npm i 0console
```
# 🏁 Use
With patched console object:
```js
require("0console").patch();
console.log("Hello World!");
console.log("Highlighted", "Hello World!");
```
Without patching the console object:
```js
const $console = require("0console");
$console.log("Hello World!");
$console.log("Highlighted", "Hello World!");
```
# ⚙️ Functions
- `console.log(...args)` : Writes a normal message.
- `console.info(...args)` : Writes an information message.
- `console.warn(...args)` : Writes a warning message.
- `console.error(...args)` : Writes an error message.
- `console.clear(...args)` : Clears the output (Unlike the original).
- 🆕 `console.success(...args)` : Writes a success message.
- 🆕 `console.line(char?, color?, count?)` : Writes an horizontal line.
- `char` : text to repeat (one character).
- `color` : text color in the console (Using [Chalk](https://github.com/chalk/chalk)).
- `count` : times to repeat `char` (Length of the line).
💡 If a logging function (log, info, warn, error, success) has more than one argument, the text of the first argument will be highlighted in the console.
# ⚙️ Craft Function
You can craft your own custom function:
```js
const $console = require("0console");
const newConsoleInfo = $console.craft(console.info, {
prefix: { text: "?", color: "cyanBright", bgColor: "bgBlueBright" },
highlight: { color: "blueBright" },
normal: { color: "blueBright" },
});
```
- `console.craft(fn, options?)` : Crafts a patched version of the given console function.
- `fn` : Console function to craft from.
- `options` : Options object.
- `prefix` : Object describing the prefix text.
- `text`: Text of the prefix.
- `color`: Color of the prefix.
- `bgColor`: Background color of the prefix.
- `highlight` : Object describing the highlighted text of the first argument.
- `color`: Color of the highlighted text.
- `normal` : Object describing the normal text.
- `color`: Color of the normal text.
# 📃 License
[MIT](./LICENSE) © [Ambratolm](https://github.com/Ambratolm)