52
52
label.label Color
53
53
div.field.has-addons
54
54
div.control
55
- a.button (
56
- v-bind:style ="{ \
57
- color: newLabel.text_color, \
58
- backgroundColor: newLabel.background_color \
59
- }"
55
+ div.form__field
56
+ div.form__input
57
+ swatches( v-model ="newLabel.background_color" , colors ="basic" , \
58
+ show-fallback =true , popover-to ="" , :trigger-style ="{ \
59
+ width: '36px', height: '36px' }" )
60
+ div.control
61
+ a.button.random-color-button (
60
62
v-on:click ="setColor(newLabel)"
61
63
)
62
64
span.icon.is-small
63
65
i.fas.fa-sync-alt
64
66
65
- div.control.is-expanded
66
- input.input (
67
- type ="text"
68
- placeholder ="Text input"
69
- v-model ="newLabel.background_color"
70
- )
71
-
72
67
div.column
73
68
div.field
74
69
label.label
151
146
label.label Color
152
147
div.field.has-addons
153
148
div.control
154
- a.button.has-text-white (
155
- v-bind:style ="{ backgroundColor: label.background_color }"
156
- v-on:click ="setColor(label)"
149
+ div.form__field
150
+ div.form__input
151
+ swatches( v-model ="label.background_color" , colors ="basic" , \
152
+ show-fallback =true , popover-to ="" , :trigger-style ="{ \
153
+ width: '36px', height: '36px' }" )
154
+ div.control
155
+ a.button.random-color-button (
156
+ v-on:click ="setColor(newLabel)"
157
157
)
158
158
span.icon.is-small
159
159
i.fas.fa-sync-alt
160
160
161
- div.control.is-expanded
162
- input.input (
163
- type ="text"
164
- placeholder ="Text input"
165
- v-model ="label.background_color"
166
- )
167
-
168
161
div.column
169
162
div.field
170
163
label.label
176
169
a.button.is-primary ( v-on:click ="doneEdit(label)" ) Save changes
177
170
</template >
178
171
172
+ <style scoped>
173
+ .random-color-button {
174
+ height : 36px ;
175
+ width : 36px ;
176
+ background-color : transparent ;
177
+ color : #404040 ;
178
+ border : none ;
179
+ }
180
+ </style >
181
+
179
182
<script >
183
+ import Swatches from ' vue-swatches' ;
184
+ import ' vue-swatches/dist/vue-swatches.min.css' ;
180
185
import HTTP from ' ./http' ;
181
186
import Messages from ' ./messages.vue' ;
182
187
import { simpleShortcut } from ' ./filter' ;
183
188
184
189
export default {
185
- components: { Messages },
190
+ components: { Messages, Swatches },
186
191
187
192
filters: { simpleShortcut },
188
193
@@ -203,8 +208,8 @@ export default {
203
208
204
209
methods: {
205
210
generateColor () {
206
- const color = Math .floor (Math .random () * 0xFFFFFF ).toString (16 );
207
- const randomColor = ' #' + (' 000000' + color ).slice (- 6 );
211
+ const gencolor = Math .floor (Math .random () * 0xFFFFFF ).toString (16 );
212
+ const randomColor = ' #' + (' 000000' + gencolor ).slice (- 6 );
208
213
return randomColor;
209
214
},
210
215
@@ -264,6 +269,7 @@ export default {
264
269
background_color: ' #209cee' ,
265
270
text_color: ' #ffffff' ,
266
271
};
272
+ this .setColor (this .newLabel );
267
273
},
268
274
269
275
cancelCreate () {
0 commit comments