JS console colors
Just wondering if there is a way to change the text color using
You can change the color of a console.log by adding %c to the beginning of your message and adding css as the second argument.
console.log('%c Hello world ', 'background: #000; color: red');
Please mark this comment as the answer if it helped. Thanks!
One of the most popular libraries to add colored text is called
However, it doesn't seem to be supported on replit at the moment. (see screenshot) :P
There is a way to do it.
Checkout this StackOverflow post. Basically, you can write something like this:
console.log('\x1b[31m%s\x1b[0m', 'I am red');
And have the output be red :)
I made a repl here if you want to check it out.