diff --git a/apps/dashboard/src/lib/utils/functions/theme.ts b/apps/dashboard/src/lib/utils/functions/theme.ts index 6fa4f378..167d3a73 100644 --- a/apps/dashboard/src/lib/utils/functions/theme.ts +++ b/apps/dashboard/src/lib/utils/functions/theme.ts @@ -2,10 +2,10 @@ import { darken, lighten } from 'color2k'; import { tc } from '$lib/utils/functions/trycatch'; -export function setTheme(theme: string) { +export function setTheme(theme: string = '') { localStorage.setItem('theme', theme); - if (theme.includes('#')) { + if (theme?.includes('#')) { const escapedHex = theme.replace(/"/g, '\\"'); document.body.setAttribute('data-theme', escapedHex);