cyhnkckali / vue3-color-picker

The Unlicense
32 stars 8 forks source link

Add option to allow empty values #26

Open marcopixel opened 1 month ago

marcopixel commented 1 month ago

Description

When initializing the color picker with a empty value it will default to a hardcoded color from the colorList array.

https://github.com/cyhnkckali/vue3-color-picker/blob/cf16d8f71b62bb692653e56eb019da2ca1c40088/src/components/Vue3ColorPicker.vue#L364-L367

https://github.com/cyhnkckali/vue3-color-picker/blob/cf16d8f71b62bb692653e56eb019da2ca1c40088/src/components/Vue3ColorPicker.vue#L1484-L1493

https://github.com/cyhnkckali/vue3-color-picker/blob/cf16d8f71b62bb692653e56eb019da2ca1c40088/src/components/Vue3ColorPicker.vue#L1398-L1400

My best guess it happens inside the handleChangeInputType() function but it can be also a side effect somewhere deeper inside.

What should happen?

It would be nice to keep the empty value until we first interact with the color picker. Since not everyone wants it to be empty i would be fine having a seperate option (:allow-empty-value="true") to enable that feature.

Environment:

├── @cyhnkckali/vue3-color-picker@2.0.2
├── @vitejs/plugin-vue@5.0.4
├── typescript@5.4.5
├── vite@5.2.12
└── vue@3.4.27

Chrome 125.0.6422.142
Node v20.11.1
marcopixel commented 1 month ago

Also thank you for your hard work - it's an amazing component and it works flawless so far 🎉

cyhnkckali commented 1 month ago

Hi @marcopixel, I'm gonna have to try this. You want the list to be empty, but that's the plan. Maybe there may be a feature like giving different values for Start. I will see how it behaves in case it is empty.