Colors in JavaScript console

Randomblue picture Randomblue · Sep 21, 2011 · Viewed 429k times · Source

Can Chrome's built-in JavaScript console display colors?

I want errors in red, warnings in orange and console.log's in green. Is that possible?

Answer

christianvuerings picture christianvuerings · Oct 22, 2012

In Chrome & Firefox (+31) you can add CSS in console.log messages:

console.log('%c Oh my heavens! ', 'background: #222; color: #bada55');

Console color example in Chrome

The same can be applied for adding multiple CSS to same command. syntax for multi coloring chrome console messages

References