From 4aa5da9a669c58dbe43600e576bcfc0346c121a0 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 15 May 2023 13:36:47 -0700 Subject: Make theme dynamic --- modern/src/common/theme/palette.js | 48 ++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 23 deletions(-) (limited to 'modern/src/common/theme/palette.js') diff --git a/modern/src/common/theme/palette.js b/modern/src/common/theme/palette.js index c6cb00d9..dfc8b9dd 100644 --- a/modern/src/common/theme/palette.js +++ b/modern/src/common/theme/palette.js @@ -2,28 +2,30 @@ import { amber, grey, green, indigo, red, common, } from '@mui/material/colors'; -const colors = { - white: common.white, - background: grey[50], - primary: indigo[900], - secondary: green[800], - positive: green[500], - medium: amber[700], - negative: red[500], - neutral: grey[500], - geometry: '#3bb2d0', -}; +export default (server) => { + const colors = { + white: common.white, + background: grey[50], + primary: server?.attributes?.colorPrimary || indigo[900], + secondary: server?.attributes?.colorSecondary || green[800], + positive: green[500], + medium: amber[700], + negative: red[500], + neutral: grey[500], + geometry: '#3bb2d0', + }; -export default { - background: { - default: colors.background, - }, - primary: { - main: colors.primary, - }, - secondary: { - main: colors.secondary, - contrastText: colors.white, - }, - colors, + return { + background: { + default: colors.background, + }, + primary: { + main: colors.primary, + }, + secondary: { + main: colors.secondary, + contrastText: colors.white, + }, + colors, + }; }; -- cgit v1.2.3