In this tutorial I will show you the easiest way to style output string of JavaScript browser console.
The first parameter of console.log()
may contain format specifiers(a string token composed of the % sign followed by a letter that indicates the formatting to be applied). And then we can provide a comma seperated list of values for the format specifiers serially.
One of the format specifier is %c
which formats the output string according to CSS styles you provide.
Here is example code on how to style
Here is how it looks in console screen
If you want to log error message, warning message or some extra information then instead of styling the color its preferred to use console.error()
, console.warning()
and console.info()
respectively.
Leave a Reply