- Instant help with your JavaScript coding problems

Use colors in JavaScript console

Question:
How to use colors in JavaScript console?
Answer:
console.log('%cTest message', 'color: #008000; font-weight:bold;');
Description:

You can use the %c directive to apply a CSS style to console output. The text before the directive will not be affected, but the text after the directive will be styled using the CSS declarations in the parameter. You may use %c multiple times.

Share "How to use colors in JavaScript console?"
Related snippets:
Tags:
javascript console, color in console, console.log style
Technical term:
Use colors in JavaScript console