Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@anasnakawa
Last active January 10, 2019 13:49
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 anasnakawa/68c8d65c40eb97c84f826e8f81dca2f2 to your computer and use it in GitHub Desktop.
Save anasnakawa/68c8d65c40eb97c84f826e8f81dca2f2 to your computer and use it in GitHub Desktop.
/**
* 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