Add browser level dark color scheme

This commit is contained in:
Ted Adams 2023-01-26 10:46:48 -08:00
parent b6d94ecdc4
commit c6e8688dc0
1 changed files with 13 additions and 2 deletions

View File

@ -30,12 +30,23 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
import { extendTheme, type ThemeConfig } from '@chakra-ui/react'; import { extendTheme, type Theme, type ThemeConfig } from '@chakra-ui/react';
const config: ThemeConfig = { const config: ThemeConfig = {
initialColorMode: 'system', initialColorMode: 'system',
}; };
const theme = extendTheme({ config }); const styles: Theme['styles'] = {
global: (props) => ({
':root': {
colorScheme: props.colorMode,
},
}),
};
const theme = extendTheme({
config,
styles,
});
export default theme; export default theme;