aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common/theme/palette.js
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/common/theme/palette.js')
-rw-r--r--modern/src/common/theme/palette.js43
1 files changed, 18 insertions, 25 deletions
diff --git a/modern/src/common/theme/palette.js b/modern/src/common/theme/palette.js
index 7bd63dac..f32ed93e 100644
--- a/modern/src/common/theme/palette.js
+++ b/modern/src/common/theme/palette.js
@@ -1,29 +1,22 @@
-import { useMediaQuery } from '@mui/material';
import { grey, green, indigo } from '@mui/material/colors';
const validatedColor = (color) => (/^#([0-9A-Fa-f]{3}){1,2}$/.test(color) ? color : null);
-export default (server) => {
- const preferDarkMode = useMediaQuery('(prefers-color-scheme: dark)');
- const serverDarkMode = server?.attributes?.darkMode;
- const darkMode = serverDarkMode !== undefined ? serverDarkMode : preferDarkMode;
-
- return {
- mode: darkMode ? 'dark' : 'light',
- background: {
- default: darkMode ? grey[900] : grey[50],
- },
- primary: {
- main: validatedColor(server?.attributes?.colorPrimary) || (darkMode ? indigo[200] : indigo[900]),
- },
- secondary: {
- main: validatedColor(server?.attributes?.colorSecondary) || (darkMode ? green[200] : green[800]),
- },
- neutral: {
- main: grey[500],
- },
- geometry: {
- main: '#3bb2d0',
- },
- };
-};
+export default (server, darkMode) => ({
+ mode: darkMode ? 'dark' : 'light',
+ background: {
+ default: darkMode ? grey[900] : grey[50],
+ },
+ primary: {
+ main: validatedColor(server?.attributes?.colorPrimary) || (darkMode ? indigo[200] : indigo[900]),
+ },
+ secondary: {
+ main: validatedColor(server?.attributes?.colorSecondary) || (darkMode ? green[200] : green[800]),
+ },
+ neutral: {
+ main: grey[500],
+ },
+ geometry: {
+ main: '#3bb2d0',
+ },
+});