Skip to content

Instantly share code, notes, and snippets.

@mediaupstream
Created May 13, 2015 00:39
Show Gist options
  • Save mediaupstream/8b18d1986a5dc57010b7 to your computer and use it in GitHub Desktop.
Save mediaupstream/8b18d1986a5dc57010b7 to your computer and use it in GitHub Desktop.
console.rainbow.js
var _original_unmodified_console_log_thingy = console.log;
console.log = function(){
var args = Array.prototype.slice.call(arguments);
var rainbow = ['red','orange','yellow','green','cyan','blue','purple','pink'];
var cindex = 0;
var style = 'font-family: "Comic Sans MS", "Comic Sans", cursive; font-size:18px;';
var styles = [];
for(var i=0; i<args.length; i++){
if (typeof args[i] == 'string'){
var a = args[i].split('')
for(var j=0; j<a.length; j++){
a[j] = '%c'+a[j];
if (cindex >= rainbow.length) cindex = 0;
styles.push(style + 'color:'+ rainbow[cindex]);
cindex++;
}
args[i] = a.join('')
}
}
for(var i=0; i<styles.length; i++){
args.push(styles[i]);
}
_original_unmodified_console_log_thingy.apply(this, args);
};
@mediaupstream
Copy link
Author

copy / paste this into your chrome javascript console and you should then get much more enjoyable console.log output 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment