fix(theme): fix home hero background tint-plate rendering fail, close #775 (#776)

This commit is contained in:
pengzhanbo 2025-12-04 14:10:27 +08:00 committed by GitHub
parent d677fc99de
commit 5f82bdeb67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,9 +17,9 @@ const config = computed(() => {
return rgb
}
if (light || dark) {
return { light, dark }
return cleanObject({ light, dark })
}
return { r, g, b }
return cleanObject({ r, g, b })
})
const lightTint = {
@ -34,6 +34,14 @@ const darkTint = {
b: { value: 32, offset: 36 },
}
function cleanObject(obj: any) {
for (const key in obj) {
if (obj[key] === undefined)
delete obj[key]
}
return obj
}
function toPlate(plate: number | string) {
return typeof plate === 'number' || Number(plate) === Number.parseInt(plate)
? [plate, plate, plate].map(n => Number(n))