File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
playground/app/pages/components Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 1
1
<script setup lang="ts">
2
2
const colorHex = ref (' #9C27B0' )
3
+
4
+ function handleColorChange(event : Event ) {
5
+ colorHex .value = (event .target as HTMLInputElement ).value
6
+ }
3
7
</script >
4
8
5
9
<template >
6
10
<div class =" flex flex-col gap-5" >
7
11
<div class =" flex items-center gap-2" >
8
12
<span :style =" { backgroundColor: colorHex }" class =" inline-flex w-5 h-5 rounded" />
9
- <code class = " font-mono " >{{ colorHex }}</ code >
13
+ <UInput :model-value = " colorHex " @change = " handleColorChange " / >
10
14
</div >
11
15
<USeparator />
12
16
<div class =" flex justify-between gap-2" >
@@ -21,6 +25,6 @@ const colorHex = ref('#9C27B0')
21
25
</UButton >
22
26
</div >
23
27
<USeparator />
24
- <UColorPicker v-model =" colorHex" @update:model-value = " () => console.log('model update') " />
28
+ <UColorPicker v-model =" colorHex" />
25
29
</div >
26
30
</template >
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ function HSVtoHSL(hsv: HSVColor): HSLObject {
31
31
return {
32
32
H: hsv .h ,
33
33
S: x === 0 || x === 200 ? 0 : Math .round (hsv .s * hsv .v / (x <= 100 ? x : 200 - x )),
34
- L: Math . round ( x / 2 )
34
+ L: x / 2
35
35
}
36
36
}
37
37
@@ -102,7 +102,6 @@ const pickedColor = computed<HSVColor>({
102
102
},
103
103
set(value ) {
104
104
const color = new ColorTranslator (HSVtoHSL (value ), {
105
- decimals: 2 ,
106
105
labUnit: ' percent' ,
107
106
cmykUnit: ' percent' ,
108
107
cmykFunction: ' cmyk'
You can’t perform that action at this time.
0 commit comments