fix: 图表主题颜色调节透明度无效

This commit is contained in:
程健 2023-04-07 17:33:53 +08:00
parent c7c5de1de2
commit 0f9bac2804
No known key found for this signature in database
GPG Key ID: BE1C6E1584432B0D

View File

@ -124,10 +124,10 @@ onMounted(renderChart)
const themeColors = computed(() => {
let colors: string[] = []
if (props.themeColor.length >= 10) colors = props.themeColor
else if (props.themeColor.length === 1) colors = tinycolor(props.themeColor[0]).analogous(10).map(color => color.toHexString())
else if (props.themeColor.length === 1) colors = tinycolor(props.themeColor[0]).analogous(10).map(color => color.toRgbString())
else {
const len = props.themeColor.length
const supplement = tinycolor(props.themeColor[len - 1]).analogous(10 + 1 - len).map(color => color.toHexString())
const supplement = tinycolor(props.themeColor[len - 1]).analogous(10 + 1 - len).map(color => color.toRgbString())
colors = [...props.themeColor.slice(0, len - 1), ...supplement]
}
return colors