Skip to content

Instantly share code, notes, and snippets.

@leemartin
Created September 20, 2018 00:31
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 leemartin/10a4cbac6d9d2272d9cab96af4bd6446 to your computer and use it in GitHub Desktop.
Save leemartin/10a4cbac6d9d2272d9cab96af4bd6446 to your computer and use it in GitHub Desktop.
Turn Palette Color Picker
<template>
<ul>
<li v-for="color in colors" :style="{ background: `rgb(${color[0]},${color[1]},${color[2]})`}" @click="selectColor(color)"></li>
</ul>
</template>
<script>
export default{
props: ['colors'],
methods: {
selectColor(color) {
this.$nuxt.$emit('COLOR_SELECTED', color)
}
}
}
</script>
<style scope>
ul{
display: flex;
height: 1em;
margin-bottom: 0.5em;
width: 100%;
}
ul li{
cursor: pointer;
flex: 1;
}
ul li:first-child{
border-radius: 0.25em 0 0 0.25em;
}
ul li:last-child{
border-radius: 0 0.25em 0.25em 0;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment