When I console.log a text like this:
console.log(chalk.bgWhite.black('hello world'));
It creates the following output:

Is there any way that I can format the while line other than just then encapsulated words.
Kind of a hack, but try this:
const padConsoleWidth = (s, stream = process.stdout) => s + ' '.repeat(stream.columns - s.length);
console.log(chalk.bgWhite.black(padConsoleWidth('Hello, World!')));
This won't work in all cases but should work in _most_ of them.
Thank you I will give it a try.
Doing something similar now, thought there might be a smarter way.
Unfortunately not; some terminal emulators will color the rest of the line if you insert the newline before the render mode reset but that's inconsistent behavior at best.
This is the most "correct" way (keeping in mind that all ANSI escape/TTY stuff is horribly archaic).
Hope that helps :)
@Qix- At least it gave me a new idea. Currently used chalk for syntax highlighting with PrismJS with console.log in NodeJS.
Some themes there have some strange colouring.
Details: https://t.co/1gyFTTVEm6?amp=1