Created
September 20, 2018 00:31
-
-
Save leemartin/10a4cbac6d9d2272d9cab96af4bd6446 to your computer and use it in GitHub Desktop.
Turn Palette Color Picker
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
<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