Skip to content

Instantly share code, notes, and snippets.

@jakelazaroff
Created September 23, 2013 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakelazaroff/6676208 to your computer and use it in GitHub Desktop.
Save jakelazaroff/6676208 to your computer and use it in GitHub Desktop.
Allows you to pass an arbitrary number of CSS properties in a JavaScript object to style a console log. Example: prettyLog('Hello world!', { 'font-weight' : 'bold' });
var prettyLog = function (message, styles) {
var rule = '';
for (var property in styles)
rule += property + ':' + styles[property] + ';';
console.log('%c' + message, rule);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment