mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
fixed provider color bug
This commit is contained in:
parent
63a90fed35
commit
9ca2789e42
@ -30,8 +30,8 @@ type DesignContextValue = {
|
||||
|
||||
export type DesignConfig = {
|
||||
colors?: {
|
||||
dark: Partial<ColorPalette>,
|
||||
light: Partial<ColorPalette>,
|
||||
dark?: Partial<ColorPalette>,
|
||||
light?: Partial<ColorPalette>,
|
||||
},
|
||||
breakpoints?: Partial<Breakpoints>,
|
||||
} & (
|
||||
@ -61,9 +61,12 @@ export function hasCustomColorMode(config: DesignConfig): config is DesignConfig
|
||||
|
||||
function getColors(
|
||||
theme: 'dark' | 'light',
|
||||
colors: { dark: Partial<ColorPalette>, light: Partial<ColorPalette> } | undefined,
|
||||
colors: { dark?: Partial<ColorPalette>, light?: Partial<ColorPalette> } | undefined,
|
||||
): ColorPalette {
|
||||
return { ...DEFAULT_COLORS[theme], ...colors?.[theme]};
|
||||
return {
|
||||
dark: { ...DEFAULT_COLORS.dark, ...colors?.dark },
|
||||
light: { ...DEFAULT_COLORS.light, ...colors?.light },
|
||||
}[theme];
|
||||
}
|
||||
|
||||
const useColorMode = (
|
||||
|
||||
@ -28,7 +28,7 @@ export function StackTheme({
|
||||
let { colorMode, setColorMode } = theme;
|
||||
designProps = { colorMode, setColorMode };
|
||||
}
|
||||
designProps = designProps || {breakpoints: theme?.breakpoints, colors: theme?.colors};
|
||||
designProps = { breakpoints: theme?.breakpoints, colors: theme?.colors, ...designProps };
|
||||
|
||||
return (
|
||||
<ColorModeProvider {...colorModeProps}>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user