Last active
January 10, 2019 13:49
-
-
Save anasnakawa/68c8d65c40eb97c84f826e8f81dca2f2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/** | |
* acceps colors as arguments, and will simply print them out to console | |
* | |
* e.g: console.color('red', 'blue', 'green'); // prints red, blue and green squares | |
*/ | |
console.color = function() { | |
var result = ''; | |
var args = []; | |
for(var i = 0; i < arguments.length; i++) { | |
result += '%c ' + arguments[i] + ' '; | |
args.push('background: ' + arguments[i]); | |
} | |
args.unshift(result); | |
console.log.apply(console, args); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment