Last active
July 13, 2018 03:24
-
-
Save jloosli/02956a85ef30c363874371c3a9e017e6 to your computer and use it in GitHub Desktop.
Get material colors from Material website (using console)
This file contains hidden or 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 the following commands to get colors copied to console */ | |
/* https://material.io/design/color/the-color-system.html#tools-for-picking-colors */ | |
const colors = []; | |
const pallettes = $$('section.module-module-module'); | |
for (p in pallettes) {const dets = $$('.color-tag', pallettes[p]); for (d in dets) {colors.push([$('.shade', dets[d]).innerHTML, $('.hex', dets[d]).innerHTML, dets[d].classList.contains('light') ? 'light':'dark'])}}; | |
let current = ''; | |
const combo = {}; | |
for(c in colors) {let splt = colors[c][0].split(' '); let wt = splt.pop(); if (splt.length > 0) { current =splt.join(' '); combo[current]={}} let hx=colors[c][1]; combo[current][wt]={color: hx, txt: colors[c][2]};} | |
copy(combo); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment