diff --git a/frontend/src/lib/colors.ts b/frontend/src/lib/colors.ts index 1413b241800a0..cc9530b5bc524 100644 --- a/frontend/src/lib/colors.ts +++ b/frontend/src/lib/colors.ts @@ -1,3 +1,5 @@ +import { captureException } from '@sentry/react' + import { LifecycleToggle } from '~/types' import { LemonTagType } from './lemon-ui/LemonTag' @@ -39,7 +41,9 @@ export const tagColors: LemonTagType[] = [ export function getColorVar(variable: string): string { const colorValue = getComputedStyle(document.body).getPropertyValue('--' + variable) if (!colorValue) { - throw new Error(`Couldn't find color variable --${variable}`) + captureException(new Error(`Couldn't find color variable --${variable}`)) + // Fall back to black or white depending on the theme + return document.body.getAttribute('theme') === 'light' ? '#000' : '#fff' } return colorValue.trim() }