diff --git a/theme/src/client/components/background/TintPlate.vue b/theme/src/client/components/background/TintPlate.vue index 589a1e9e..dcad91b5 100644 --- a/theme/src/client/components/background/TintPlate.vue +++ b/theme/src/client/components/background/TintPlate.vue @@ -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))