Skip to content

Instantly share code, notes, and snippets.

@bodinsamuel
Created April 8, 2014 12:35
Show Gist options
  • Save bodinsamuel/10117603 to your computer and use it in GitHub Desktop.
Save bodinsamuel/10117603 to your computer and use it in GitHub Desktop.
JS: Array of Color to Console
// When you have an array of color (in themes or whatever)
// You want to know whatit will display, but it's very boring to copy/paste in a color picker.
var color_array_to_console = function(array) {
console.log(array, 'There is ', array.length, ' colors');
for(var i = 0; i < array.length; i++)
console.log("%c███ " + array[i], "color: " + array[i] + ";");
};
color_array_to_console([
'#058DC7','#ED561B','#e256ae','#E34A33','#e2cf56','#e25668',
'#e28956','#2CA25F','#56aee2'
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment