aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common/theme/palette.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-05-15 13:36:47 -0700
committerAnton Tananaev <anton@traccar.org>2023-05-15 13:36:47 -0700
commit4aa5da9a669c58dbe43600e576bcfc0346c121a0 (patch)
treeaf7ac9d66354dfc26ca4e115c03c3ca0c1fbd8c6 /modern/src/common/theme/palette.js
parent474104189d270df752d8a177685c2ab413683b3a (diff)
downloadtrackermap-web-4aa5da9a669c58dbe43600e576bcfc0346c121a0.tar.gz
trackermap-web-4aa5da9a669c58dbe43600e576bcfc0346c121a0.tar.bz2
trackermap-web-4aa5da9a669c58dbe43600e576bcfc0346c121a0.zip
Make theme dynamic
Diffstat (limited to 'modern/src/common/theme/palette.js')
-rw-r--r--modern/src/common/theme/palette.js48
1 files changed, 25 insertions, 23 deletions
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,
+ };
};