Skip to content

Commit

Permalink
🔨 [Sketch] move isTransparent to mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
linx4200 committed Aug 6, 2018
1 parent 2118264 commit de68e59
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/components/Sketch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@
<template v-for="c in presetColors">
<div
class="vc-sketch-presets-color"
v-if="!colorIsTransparent(c)"
v-if="!isTransparent(c)"
:aria-label="'color:'+c"
:key="c"
:style="{background: c}"
@click="handlePreset(c)">
</div>
<div
:key="c"
class="vc-sketch-presets-color"
v-else
@click="handlePreset(c)">
Expand All @@ -63,7 +64,6 @@ import saturation from './common/Saturation.vue'
import hue from './common/Hue.vue'
import alpha from './common/Alpha.vue'
import checkboard from './common/Checkboard.vue'
import tinycolor from 'tinycolor2'
const presetColors = [
'#D0021B', '#F5A623', '#F8E71C', '#8B572A', '#7ED321',
Expand Down Expand Up @@ -114,9 +114,6 @@ export default {
source: 'hex'
})
},
colorIsTransparent (c) {
return tinycolor(c).getAlpha() === 0;
},
childChange (data) {
this.colorChange(data)
},
Expand Down
3 changes: 3 additions & 0 deletions src/mixin/color.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ export default {
},
paletteUpperCase (palette) {
return palette.map(c => c.toUpperCase())
},
isTransparent (color) {
return tinycolor(color).getAlpha() === 0
}
}
}

0 comments on commit de68e59

Please sign in to comment.