Created
May 11, 2017 21:37
-
-
Save mk30/b82cdc284d46e800cfcbf5c59d9a0034 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
function colors (onclick) { | |
var pkeys = Object.keys(state.paletteMap) | |
var prows = [] | |
for (var i = 0; i < pkeys.length; i += 10) { | |
prows.push(pkeys.slice(i,i+10)) | |
} | |
return html`<div class="colors"> | |
${prows.map(function (row) { | |
return html`<div> | |
${row.map(function (src) { | |
var dst = state.paletteMap[src] | |
return html`<button style="background-color:#${dst}" | |
class=${dst === state.activeColor ? 'selected' : ''} | |
onclick=${function (ev) { onclick(dst,ev) }}></button>` | |
})} | |
</div>` | |
})} | |
</div>` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment