Created
October 21, 2014 10:14
-
-
Save albinekb/4702cee2f5c46a22d3d5 to your computer and use it in GitHub Desktop.
This file contains 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
// run at http://www.google.com/design/spec/style/color.html#color-ui-color-palette | |
var hex = ""; | |
var rgb = ""; | |
var g = document.getElementsByClassName('color-group'); | |
for (var i = 0; i < g.length; i++){ | |
var c = g[i].getElementsByClassName('color'); | |
var title = c[0].textContent.split('\n')[1].replace(/\s+/g, ''); | |
title = title.charAt(0).toLowerCase() + title.substring(1); | |
for (var a = 1; a < c.length; a++){ | |
hex += ('@' + title + '--' + c[a].textContent.split('#')[0] + ': #' + c[a].textContent.split('#')[1] + ';\n') | |
rgb += ('@' + title + '--' + c[a].textContent.split('#')[0] + ': ' + c[a].style.backgroundColor + ';\n') | |
} | |
} | |
console.log(hex); | |
console.log(rgb); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment