3

I just read this SO question/answer and it said to change the color, use

console.log("%cYour Message Here", "color:(your color);font-weight:bold;");

I have tested this and messed around with it a bit, and changed it to

console.log("Test\n\n%cTest\n\nTest", "color:red;font-weight:bold;");

this outputs (where the bolded text is also red)

Test

Test

Test

Is there a way to cause the output (where bold is red and italics is blue)

Test

Test

Test

Community
  • 1
  • 1
ZomoXYZ
  • 1,415
  • 15
  • 40
  • More info here http://stackoverflow.com/questions/7505623/colors-in-javascript-console – Andy Apr 11 '16 at 16:03

2 Answers2

7
console.log("Test\n\n%cTest\n\n%cTest", "color:red;", "color:blue;");

I do however feel that the following is much more readable.

console.log("Test");
console.log("%cTest", "color:red");
console.log("%cTest", "color:blue");

Check https://developer.chrome.com/devtools/docs/console-api#consolelogobject-object for a full reference.

Joey Ciechanowicz
  • 2,711
  • 3
  • 19
  • 45
0
console.log("Test");
console.log("%cTest", "color:red;font-weight:bold");
console.log("%cTest", "color:blue;font-style:italic");
Nick Rassadin
  • 710
  • 5
  • 7