This repository was archived by the owner on Mar 8, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ Extend & Extend Theme token is described as the following section.
4848` app/layout.tsx `
4949
5050``` tsx
51- <DesignProvider cookies = { cookies (). getAll () } cookiesString = { cookies (). toString () } theme = { AppTheme } >
51+ <DesignProvider initialColorMode = { ' dark ' /* or light */ } theme = { AppTheme } >
5252 { children }
5353</DesignProvider >
5454```
@@ -63,7 +63,7 @@ All components are wrapping of Chakra-UI components.
6363
6464So you can use all the ` styled-system ` syntax used in it.
6565
66- Currently, css variables always have a prefix of ` --ck ` , but this will be changed so that it can be set in a future update .
66+ Currently, css variables always have a prefix of ` --ck ` , this can be changed by chakra-ui ` css-var-prefix ` config feature .
6767
6868For example, colors can be used in CSS like ` var(--ck-colors-red-500) ` .
6969
Original file line number Diff line number Diff line change @@ -15,25 +15,26 @@ import { InitialCookiesProvider } from './InitialCookieProvider';
1515
1616type Props = PropsWithChildren < {
1717 theme ?: Dict ;
18- initialColorMode ?: 'dark' | 'light' ;
18+ /** color mode of theme, default: light */
19+ colorMode ?: 'dark' | 'light' ;
1920 enableColorModeScript ?: boolean ;
2021} > ;
2122
2223const cookieKey = 'chakra-ui-color-mode' ;
2324export const DesignProvider = ( {
2425 children,
2526 theme,
26- initialColorMode = 'light' ,
27+ colorMode = 'light' ,
2728 enableColorModeScript = true ,
2829} : Props ) => {
2930 return (
30- < InitialCookiesProvider cookies = { [ { name : cookieKey , value : initialColorMode } ] } >
31+ < InitialCookiesProvider cookies = { [ { name : cookieKey , value : colorMode } ] } >
3132 { enableColorModeScript ? (
32- < ColorModeScript initialColorMode = { initialColorMode } type = { 'cookie' } />
33+ < ColorModeScript initialColorMode = { colorMode } type = { 'cookie' } />
3334 ) : null }
3435 < StyledComponentsRegistry >
3536 < ChakraProvider
36- colorModeManager = { cookieStorageManagerSSR ( `cookieKey=${ initialColorMode } ` ) }
37+ colorModeManager = { cookieStorageManagerSSR ( `${ cookieKey } =${ colorMode } ` ) }
3738 theme = { theme ?? baseTheme }
3839 >
3940 < AppAlertDialogProvider > { children } </ AppAlertDialogProvider >
You can’t perform that action at this time.
0 commit comments