feat: extra css property for themes

allows adding extra css to custom themes, useful for loading fonts, etc.
This commit is contained in:
diced
2025-08-16 14:46:28 -07:00
parent 8a5972c517
commit c43afc1145
2 changed files with 17 additions and 12 deletions

View File

@@ -65,17 +65,21 @@ export default function ThemeProvider({
}
return (
<ThemeContext.Provider value={{ themes: themes ?? [] }}>
<MantineProvider
defaultColorScheme={theme.colorScheme as unknown as any}
forceColorScheme={theme.colorScheme as unknown as any}
theme={createTheme({
...themeComponents(theme),
defaultRadius: 'md',
})}
>
{children}
</MantineProvider>
</ThemeContext.Provider>
<>
{theme?.extraCss && <style>{theme.extraCss}</style>}
<ThemeContext.Provider value={{ themes: themes ?? [] }}>
<MantineProvider
defaultColorScheme={theme.colorScheme as unknown as any}
forceColorScheme={theme.colorScheme as unknown as any}
theme={createTheme({
...themeComponents(theme),
defaultRadius: 'md',
})}
>
{children}
</MantineProvider>
</ThemeContext.Provider>
</>
);
}

View File

@@ -16,6 +16,7 @@ export type ZiplineTheme = MantineTheme & {
name: string;
colorScheme: string;
mainBackgroundColor: string;
extraCss?: string;
};
export function findTheme(id: string, themes: ZiplineTheme[] = []): ZiplineTheme | undefined {