aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-08-27 17:08:08 -0700
committerAnton Tananaev <anton@traccar.org>2023-08-27 17:08:08 -0700
commitd257aa2fb592c8def4ff40630914127575b87062 (patch)
treed55efd2bd145a9565bb4bc0d1f1f336bbf53dd2a /modern/src/common
parent778d626e5ca58f62b75ef070c5c347afa89a6de4 (diff)
downloadtrackermap-web-d257aa2fb592c8def4ff40630914127575b87062.tar.gz
trackermap-web-d257aa2fb592c8def4ff40630914127575b87062.tar.bz2
trackermap-web-d257aa2fb592c8def4ff40630914127575b87062.zip
Streamline theme palette
Diffstat (limited to 'modern/src/common')
-rw-r--r--modern/src/common/theme/palette.js25
-rw-r--r--modern/src/common/util/formatter.js10
2 files changed, 14 insertions, 21 deletions
diff --git a/modern/src/common/theme/palette.js b/modern/src/common/theme/palette.js
index 99288aee..7bd63dac 100644
--- a/modern/src/common/theme/palette.js
+++ b/modern/src/common/theme/palette.js
@@ -1,7 +1,5 @@
import { useMediaQuery } from '@mui/material';
-import {
- amber, grey, green, indigo, red,
-} from '@mui/material/colors';
+import { grey, green, indigo } from '@mui/material/colors';
const validatedColor = (color) => (/^#([0-9A-Fa-f]{3}){1,2}$/.test(color) ? color : null);
@@ -10,27 +8,22 @@ export default (server) => {
const serverDarkMode = server?.attributes?.darkMode;
const darkMode = serverDarkMode !== undefined ? serverDarkMode : preferDarkMode;
- const colors = {
- primary: validatedColor(server?.attributes?.colorPrimary) || (darkMode ? indigo[200] : indigo[900]),
- secondary: validatedColor(server?.attributes?.colorSecondary) || (darkMode ? green[200] : green[800]),
- positive: green[500],
- medium: amber[700],
- negative: red[500],
- neutral: grey[500],
- geometry: '#3bb2d0',
- };
-
return {
mode: darkMode ? 'dark' : 'light',
background: {
default: darkMode ? grey[900] : grey[50],
},
primary: {
- main: colors.primary,
+ main: validatedColor(server?.attributes?.colorPrimary) || (darkMode ? indigo[200] : indigo[900]),
},
secondary: {
- main: colors.secondary,
+ main: validatedColor(server?.attributes?.colorSecondary) || (darkMode ? green[200] : green[800]),
+ },
+ neutral: {
+ main: grey[500],
+ },
+ geometry: {
+ main: '#3bb2d0',
},
- colors,
};
};
diff --git a/modern/src/common/util/formatter.js b/modern/src/common/util/formatter.js
index 0f7d2cc8..b00896c2 100644
--- a/modern/src/common/util/formatter.js
+++ b/modern/src/common/util/formatter.js
@@ -100,9 +100,9 @@ export const formatCoordinate = (key, value, unit) => {
export const getStatusColor = (status) => {
switch (status) {
case 'online':
- return 'positive';
+ return 'success';
case 'offline':
- return 'negative';
+ return 'error';
case 'unknown':
default:
return 'neutral';
@@ -111,12 +111,12 @@ export const getStatusColor = (status) => {
export const getBatteryStatus = (batteryLevel) => {
if (batteryLevel >= 70) {
- return 'positive';
+ return 'success';
}
if (batteryLevel > 30) {
- return 'medium';
+ return 'warning';
}
- return 'negative';
+ return 'error';
};
export const formatNotificationTitle = (t, notification, includeId) => {