From f0b07428bca5d2040dfb0b6169157d0763afe922 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Thu, 21 Aug 2025 19:27:56 -0700 Subject: [PATCH] feat(theme): added custom envvars for themes (#1089) * feat(theme): added custom envvars for themes * add regec --- apps/sim/app/layout.tsx | 12 + apps/sim/lib/branding/branding.ts | 34 +++ apps/sim/lib/branding/inject-theme.ts | 29 +++ apps/sim/lib/env.ts | 308 ++++++++++++++------------ 4 files changed, 236 insertions(+), 147 deletions(-) create mode 100644 apps/sim/lib/branding/inject-theme.ts diff --git a/apps/sim/app/layout.tsx b/apps/sim/app/layout.tsx index d20603d6e3..0a8d192dc9 100644 --- a/apps/sim/app/layout.tsx +++ b/apps/sim/app/layout.tsx @@ -3,6 +3,7 @@ import { SpeedInsights } from '@vercel/speed-insights/next' import type { Metadata, Viewport } from 'next' import { PublicEnvScript } from 'next-runtime-env' import { BrandedLayout } from '@/components/branded-layout' +import { generateThemeCSS } from '@/lib/branding/inject-theme' import { generateBrandedMetadata, generateStructuredData } from '@/lib/branding/metadata' import { env } from '@/lib/env' import { isHosted } from '@/lib/environment' @@ -62,6 +63,7 @@ export const metadata: Metadata = generateBrandedMetadata() export default function RootLayout({ children }: { children: React.ReactNode }) { const structuredData = generateStructuredData() + const themeCSS = generateThemeCSS() return ( @@ -74,6 +76,16 @@ export default function RootLayout({ children }: { children: React.ReactNode }) }} /> + {/* Theme CSS Override */} + {themeCSS && ( +