1
0

fix(color picker): when picking a color, the color picker should not be black afterwards

This commit is contained in:
kolaente
2024-01-21 20:25:19 +01:00
parent b8c21c2ade
commit c7b70844c6
2 changed files with 10 additions and 1 deletions

View File

@ -64,6 +64,15 @@ const emit = defineEmits(['update:modelValue'])
watch(
() => modelValue,
(newValue) => {
if (newValue === '' || newValue.startsWith('var(')) {
color.value = ''
return
}
if (!newValue.startsWith('#') && (newValue.length === 6 || newValue.length === 3)) {
newValue = `#${newValue}`
}
color.value = newValue
},
{immediate: true},