diff --git a/src/components/HSVInput.vue b/src/components/HSVInput.vue index daad904..e7555f2 100644 --- a/src/components/HSVInput.vue +++ b/src/components/HSVInput.vue @@ -37,12 +37,19 @@ const valueSliderModel = computed({ }, }) -const color = ref(Color('#FF0000')) +const color = defineModel({ + type: Color, + default: () => Color.rgb(255, 0, 0), +}) -const sliderColor = computed(() => { +const saturationSliderColor = computed(() => { return Color.hsv(hueSliderModel.value[0], 100, valueSliderModel.value[0]) }) +const valueSliderColor = computed(() => { + return Color.hsv(hueSliderModel.value[0], saturationSliderModel.value[0], 100) +}) + const hexInput = ref('FF0000') const hueInput = ref('000') const saturationInput = ref('100') @@ -147,7 +154,7 @@ function shake() { class="w-full flex p-4 font-heading" :style="{backgroundColor: `hsl(${color.hue()},${color.saturationl()}%,${color.lightness()}%)`}">
@@ -241,7 +248,7 @@ function shake() { class="relative flex w-full touch-none select-none items-center"> + :style="{background: `linear-gradient(90deg, hsl(0, 0%, ${saturationSliderColor.lightness()}%) 0%, hsl(${saturationSliderColor.hue()}, 100%, ${saturationSliderColor.lightness()}%) 100%)`}" /> @@ -253,7 +260,7 @@ function shake() { class="relative flex w-full touch-none select-none items-center"> + :style="{background: `linear-gradient(90deg, black, hsl(${valueSliderColor.hue()}, ${valueSliderColor.saturationl()}%, ${valueSliderColor.lightness()}%) 100%`}" />