aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common/theme/palette.js
blob: 51a01c69a6a1e69d1302749292a62d14e6598b96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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: validatedColor(server?.attributes?.colorPrimary) || indigo[900],
    secondary: validatedColor(server?.attributes?.colorSecondary) || green[800],
    positive: green[500],
    medium: amber[700],
    negative: red[500],
    neutral: grey[500],
    geometry: '#3bb2d0',
  };

  return {
    background: {
      default: colors.background,
    },
    primary: {
      main: colors.primary,
    },
    secondary: {
      main: colors.secondary,
      contrastText: colors.white,
    },
    colors,
  };
};