aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/common')
-rw-r--r--modern/src/common/theme/palette.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/modern/src/common/theme/palette.js b/modern/src/common/theme/palette.js
index dfc8b9dd..51a01c69 100644
--- a/modern/src/common/theme/palette.js
+++ b/modern/src/common/theme/palette.js
@@ -2,12 +2,14 @@ import {
amber, grey, green, indigo, red, common,
} from '@mui/material/colors';
+const validatedColor = (color) => (/^#([0-9A-Fa-f]{3}){1,2}$/.test(color) ? color : null);
+
export default (server) => {
const colors = {
white: common.white,
background: grey[50],
- primary: server?.attributes?.colorPrimary || indigo[900],
- secondary: server?.attributes?.colorSecondary || green[800],
+ primary: validatedColor(server?.attributes?.colorPrimary) || indigo[900],
+ secondary: validatedColor(server?.attributes?.colorSecondary) || green[800],
positive: green[500],
medium: amber[700],
negative: red[500],