Skip to content

Instantly share code, notes, and snippets.

@bhubr
Last active February 14, 2017 08:52
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 bhubr/426d74793f71d9b0c8d1d8c5745ee0aa to your computer and use it in GitHub Desktop.
Save bhubr/426d74793f71d9b0c8d1d8c5745ee0aa to your computer and use it in GitHub Desktop.
Extract colors from flatuicolors.com
/*
I needed to get a quick flat color palette for a project of mine.
The one at https://flatuicolors.com/ is great.
Just go to the site, open your console and paste this.
It will generate a JSON array with each color and associated name.
*/
output = '[';
const $divs = $('.color');
const lastIndex = $divs.length - 1
$('.color').each((index, div) => {
const $div = $(div);
const name = $div.find('span.color-name').html();
output += '{"color":"' + $div.data('bg-color') +
'","name":"' + name +
'"}';
if( index < lastIndex ) output += ',';
});
output += ']';
console.log(output);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment