fix palette editor
This commit is contained in:
parent
ddc126f696
commit
72d5307fd9
1 changed files with 7 additions and 3 deletions
|
|
@ -16,7 +16,7 @@
|
||||||
@update:model-value="value => updatePalette(key, value)"
|
@update:model-value="value => updatePalette(key, value)"
|
||||||
/>
|
/>
|
||||||
<ContrastRatio
|
<ContrastRatio
|
||||||
v-if="contrast[key]"
|
v-if="contrast?.[key]"
|
||||||
:show-ratio="true"
|
:show-ratio="true"
|
||||||
:contrast="contrast[key]"
|
:contrast="contrast[key]"
|
||||||
/>
|
/>
|
||||||
|
|
@ -136,11 +136,15 @@ const mobile = computed(() => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const contrast = computed(() => {
|
const contrast = computed(() => {
|
||||||
|
if (props.modelValue == null) return null
|
||||||
const bg = hex2rgb(props.modelValue.bg)
|
const bg = hex2rgb(props.modelValue.bg)
|
||||||
|
const text = hex2rgb(props.modelValue.text)
|
||||||
|
const link = hex2rgb(props.modelValue.link)
|
||||||
|
if (text == null || link == null) return null
|
||||||
|
|
||||||
return {
|
return {
|
||||||
text: hints(getContrastRatio(bg, hex2rgb(props.modelValue.text))),
|
text: hints(getContrastRatio(bg, text)),
|
||||||
link: hints(getContrastRatio(bg, hex2rgb(props.modelValue.link))),
|
link: hints(getContrastRatio(bg, link)),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue