Created
December 18, 2014 10:57
-
-
Save zz85/463b8fe6e623c4c2cc99 to your computer and use it in GitHub Desktop.
black background console log for code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function stretch(args) { | |
for (var i = 0, il = args.length; i<il; i++) { | |
var c = args[i]; | |
args[i] += new Array(200).slice(c.length).join(' '); | |
} | |
return args; | |
} | |
function log() { | |
var css = 'background: black; color: red; font-weight: bold;'; | |
var args = Array.prototype.slice.call(arguments); | |
for (var i = 0, il = args.length; i<il; i++) { | |
var c = args[i]; | |
if (typeof(c) === 'string') { | |
console.log('%c' + stretch(c.split('\n')).join('\n'), css); | |
} else { | |
console.log(c) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
More interesting stuff for your console logs here -
https://coderwall.com/p/fskzdw/colorful-console-log
https://gist.github.com/vprimachenko/6523913
http://pastebin.com/Lx5gjXsA
https://gist.github.com/LeaVerou/9518902
https://developer.chrome.com/devtools/docs/console-api#consolelogobject_object
http://stackoverflow.com/questions/7505623/colors-in-javascript-console
http://www.snip2code.com/Snippet/37333/Awesomify-er-your-console-log---extended