@@ -20,7 +20,7 @@ import { ColorSchemeProvider, Global, MantineProvider } from "@mantine/core";
2020import type { ColorScheme , MantineThemeOverride } from "@mantine/core" ;
2121import { useColorScheme } from "@mantine/hooks" ;
2222import { ConfigContext } from "config" ;
23- import { FontsizeContextProvider , useFontSize } from "fontsize " ;
23+ import { FontsizeContextProvider , GlobalStyleOverridesContextProvider , useFontSize , useGlobalStyleOverrides } from "themehooks " ;
2424import React , { useCallback , useContext , useState } from "react" ;
2525
2626const Theme : ( colorScheme : ColorScheme ) => MantineThemeOverride = ( colorScheme ) => ( {
@@ -67,7 +67,7 @@ const Theme: (colorScheme: ColorScheme) => MantineThemeOverride = (colorScheme)
6767 } ,
6868 } ,
6969 colors : {
70- secondaryColorName : [ "#dcfdff" , "#b2f4fd" , "#85ebf9" , "#58e3f6" , "#36d9f3" , "#25c0d9" , "#1696aa" , "#066b7a" , "#00404a" , "#00171b" ] ,
70+ turquoise : [ "#dcfdff" , "#b2f4fd" , "#85ebf9" , "#58e3f6" , "#36d9f3" , "#25c0d9" , "#1696aa" , "#066b7a" , "#00404a" , "#00171b" ] ,
7171 } ,
7272 spacing : {
7373 xs : "0.3rem" ,
@@ -80,12 +80,21 @@ const Theme: (colorScheme: ColorScheme) => MantineThemeOverride = (colorScheme)
8080
8181function GlobalStyles ( ) {
8282 const fontSize = useFontSize ( ) ;
83+ const styleOverrides = useGlobalStyleOverrides ( ) ;
8384
8485 return (
8586 < Global styles = { ( theme ) => ( {
8687 html : {
8788 fontSize : `${ fontSize . value } em` ,
8889 } ,
90+ body : {
91+ color : styleOverrides . color === undefined
92+ ? undefined
93+ : theme . colors [ styleOverrides . color . color ] [ styleOverrides . color . shade ] ,
94+ backgroundColor : styleOverrides . backgroundColor === undefined
95+ ? undefined
96+ : theme . colors [ styleOverrides . backgroundColor . color ] [ styleOverrides . backgroundColor . shade ] ,
97+ } ,
8998 "::-webkit-scrollbar" : {
9099 width : "0.75em" ,
91100 height : "0.75em" ,
@@ -134,10 +143,12 @@ export default function CustomMantineProvider({ children }: { children: React.Re
134143 return (
135144 < ColorSchemeProvider colorScheme = { colorScheme } toggleColorScheme = { toggleColorScheme } >
136145 < FontsizeContextProvider >
137- < MantineProvider withGlobalStyles withNormalizeCSS theme = { Theme ( colorScheme ) } >
138- < GlobalStyles />
139- { children }
140- </ MantineProvider >
146+ < GlobalStyleOverridesContextProvider >
147+ < MantineProvider withGlobalStyles withNormalizeCSS theme = { Theme ( colorScheme ) } >
148+ < GlobalStyles />
149+ { children }
150+ </ MantineProvider >
151+ </ GlobalStyleOverridesContextProvider >
141152 </ FontsizeContextProvider >
142153 </ ColorSchemeProvider >
143154 ) ;
0 commit comments