File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 11import { Public_Sans } from 'next/font/google' ;
22import localFont from 'next/font/local' ;
33import { headers } from 'next/headers' ;
4+ import { APP_CONFIG_DEFAULTS } from '@/app-config' ;
45import { ApplyThemeScript , ThemeToggle } from '@/components/theme-toggle' ;
56import { getAppConfig } from '@/lib/utils' ;
67import './globals.css' ;
@@ -44,9 +45,15 @@ export default async function RootLayout({ children }: RootLayoutProps) {
4445 const hdrs = await headers ( ) ;
4546 const { accent, accentDark, pageTitle, pageDescription } = await getAppConfig ( hdrs ) ;
4647
48+ // check provided accent colors against defaults, and apply styles if they differ (or in development mode)
49+ // generate a hover color for the accent color by mixing it with 20% black
4750 const styles = [
48- accent ? `:root { --primary: ${ accent } ; }` : '' ,
49- accentDark ? `.dark { --primary: ${ accentDark } ; }` : '' ,
51+ process . env . NODE_ENV === 'development' || accent !== APP_CONFIG_DEFAULTS . accent
52+ ? `:root { --primary: ${ accent } ; --primary-hover: color-mix(in srgb, ${ accent } 80%, #000); }`
53+ : '' ,
54+ process . env . NODE_ENV === 'development' || accentDark !== APP_CONFIG_DEFAULTS . accentDark
55+ ? `.dark { --primary: ${ accentDark } ; --primary-hover: color-mix(in srgb, ${ accentDark } 80%, #000); }`
56+ : '' ,
5057 ]
5158 . filter ( Boolean )
5259 . join ( '\n' ) ;
You can’t perform that action at this time.
0 commit comments