The basics for the
But did you know that you can stylize the text you are logging? To add styles to the text you just need to add
%c to the beginning of the text that you want to style. For an example of this in action, this is the welcome message for Developer Bacon.
console.log( "%cWelcome to the console of developer bacon", "color:pink;text-transform:uppercase;font-weight:bold;" );
To add more styles to other text in the same console log you need to add the
%c just before the second group of text. You can add as many of these indicators as you want you just need to add a new style group for each text group. Here is an example of multiple styling groups in action.
console.log( "%cThis text will be bold. %cThis text will be red. %c This text will be small", "font-weight:bold;", "color:red;", "font-size:8pt" );
Originally posted on developerbacon.ca
Level up every day