Skip to content

Instantly share code, notes, and snippets.

@mikechambers
Created July 6, 2014 03:39
Show Gist options
  • Select an option

  • Save mikechambers/6a90c4b5c705a1bc43b4 to your computer and use it in GitHub Desktop.

Select an option

Save mikechambers/6a90c4b5c705a1bc43b4 to your computer and use it in GitHub Desktop.
Code to paste into Google Chrome console when viewing color themes on kuler.adobe.com, that will extract the colors into a form that can be easily used in code.
var getColorName = function () {
return CCweb.models.theme.attributes.name;
};
var getColors = function () {
return CCweb.models.theme.attributes._hexList;
}
var formatColorsIntoCode = function() {
var colors = getColors();
var n = getColorName();
var n = n.replace(/ /g,"_");
var len = colors.length;
var out = "var " + n.toUpperCase() + " = [\n";
for(var i = 0; i < len; i++) {
out += "\t\"#" + colors[i] + "\",\n"
}
out = out.slice(0, - 2);
out += "\n];";
return out;
};
formatColorsIntoCode();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment