hard coded the background colors in theme to keep them consistent between light and dark modes
This commit is contained in:
parent
c04b9b0adb
commit
61922f28ee
4 changed files with 41 additions and 14 deletions
|
|
@ -5,7 +5,7 @@ import HTTPProvider from 'providers/http'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import LoadingScreen from './LoadingScreen'
|
import LoadingScreen from './LoadingScreen'
|
||||||
import UserWrapper from './UserWrapper'
|
import UserWrapper from './UserWrapper'
|
||||||
import { Theme, ThemeProvider } from '@mui/material'
|
import { CssBaseline, Theme, ThemeProvider } from '@mui/material'
|
||||||
import { CreateTheme } from '../theme/theme'
|
import { CreateTheme } from '../theme/theme'
|
||||||
import { getThemeType, setThemeType } from '../theme/themeType'
|
import { getThemeType, setThemeType } from '../theme/themeType'
|
||||||
|
|
||||||
|
|
@ -40,6 +40,7 @@ function App() {
|
||||||
cacheLocation='localstorage'
|
cacheLocation='localstorage'
|
||||||
>
|
>
|
||||||
<ThemeProvider theme={palette}>
|
<ThemeProvider theme={palette}>
|
||||||
|
<CssBaseline />
|
||||||
<AuthWrapper setToken={setToken}>
|
<AuthWrapper setToken={setToken}>
|
||||||
{ token ?
|
{ token ?
|
||||||
<HTTPProvider token={token}>
|
<HTTPProvider token={token}>
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,11 @@ const useStyles = makeStyles((theme: Theme) => ({
|
||||||
marginRight: theme.spacing(0.5),
|
marginRight: theme.spacing(0.5),
|
||||||
[theme.breakpoints.up("md")]: {
|
[theme.breakpoints.up("md")]: {
|
||||||
marginRight: theme.spacing(1.5)
|
marginRight: theme.spacing(1.5)
|
||||||
}
|
},
|
||||||
|
color: getSignatureAccentColour() + " !important"
|
||||||
},
|
},
|
||||||
button: {
|
button: {
|
||||||
color: getSignatureAccentColour()
|
color: getSignatureAccentColour() + " !important"
|
||||||
},
|
},
|
||||||
hide: {
|
hide: {
|
||||||
display: "none"
|
display: "none"
|
||||||
|
|
@ -85,6 +86,8 @@ export default function Header(props: Props) {
|
||||||
const themeType = useThemeType();
|
const themeType = useThemeType();
|
||||||
const classes = useStyles()
|
const classes = useStyles()
|
||||||
|
|
||||||
|
console.log(getSignatureColour())
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppBar position="fixed" className={classes.appBar}>
|
<AppBar position="fixed" className={classes.appBar}>
|
||||||
<Toolbar disableGutters className={classes.toolbar}>
|
<Toolbar disableGutters className={classes.toolbar}>
|
||||||
|
|
@ -94,7 +97,8 @@ export default function Header(props: Props) {
|
||||||
color="inherit"
|
color="inherit"
|
||||||
aria-label="Open side menu"
|
aria-label="Open side menu"
|
||||||
onClick={openSide}
|
onClick={openSide}
|
||||||
className={classNames(classes.button, sideIsOpen && classes.hide)}>
|
style={{ color: getSignatureAccentColour() }}
|
||||||
|
className={classes.button}>
|
||||||
<Menu />
|
<Menu />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
{/* )} */}
|
{/* )} */}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { ChevronRight, People } from "@mui/icons-material";
|
import { ChevronRight, People, PeopleOutline, PeopleOutlined, PeopleSharp } from "@mui/icons-material";
|
||||||
import ChevronLeft from "@mui/icons-material/ChevronLeft";
|
import ChevronLeft from "@mui/icons-material/ChevronLeft";
|
||||||
import { darken, Divider, Grid2 as Grid, IconButton, lighten, List, ListItemButton, ListItemIcon, ListItemText, SwipeableDrawer, Theme, Toolbar, Tooltip, useTheme } from "@mui/material";
|
import { darken, Divider, Grid2 as Grid, IconButton, lighten, List, ListItemButton, ListItemIcon, ListItemText, SwipeableDrawer, Theme, Toolbar, Tooltip, useTheme } from "@mui/material";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
|
|
@ -6,6 +6,7 @@ import { useWidth } from "../hooks/useWidth";
|
||||||
import { makeStyles } from "@mui/styles";
|
import { makeStyles } from "@mui/styles";
|
||||||
import BindaptIcon from "../products/Bindapt/BindaptIcon";
|
import BindaptIcon from "../products/Bindapt/BindaptIcon";
|
||||||
import { Link, useLocation } from "react-router-dom";
|
import { Link, useLocation } from "react-router-dom";
|
||||||
|
import { getSignatureAccentColour } from "services/whiteLabel";
|
||||||
|
|
||||||
const drawerWidth = 230;
|
const drawerWidth = 230;
|
||||||
|
|
||||||
|
|
@ -49,8 +50,9 @@ const useStyles = makeStyles((theme: Theme) => ({
|
||||||
[theme.breakpoints.up("md")]: {
|
[theme.breakpoints.up("md")]: {
|
||||||
paddingLeft: theme.spacing(3),
|
paddingLeft: theme.spacing(3),
|
||||||
paddingRight: theme.spacing(3)
|
paddingRight: theme.spacing(3)
|
||||||
}
|
},
|
||||||
},
|
color: theme.palette.mode === "light" ? "white" : "black"
|
||||||
|
},
|
||||||
activeItem:
|
activeItem:
|
||||||
theme.palette.mode === "light"
|
theme.palette.mode === "light"
|
||||||
? {
|
? {
|
||||||
|
|
|
||||||
|
|
@ -11,15 +11,15 @@ export function CreateTheme(themeType: "light" | "dark"): Theme {
|
||||||
return responsiveFontSizes(createTheme(options(themeType)));
|
return responsiveFontSizes(createTheme(options(themeType)));
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateBackgroundShades(baseColor: string, themeType: "light" | "dark") {
|
function generateBackgroundShades(themeType: "light" | "dark") {
|
||||||
if(themeType==="light") return ({
|
if(themeType==="light") return ({
|
||||||
default: lighten(baseColor, 0.75),
|
default: "#f2f2f2",
|
||||||
paper: lighten(baseColor, 0.75)
|
paper: "#fafafa"
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
default: darken(baseColor, 0.50), // Lightens the base color for background.default
|
default: "#303030", // Lightens the base color for background.default
|
||||||
paper: darken(baseColor, 0.50), // Slightly less light for background.paper
|
paper: "#424242", // Slightly less light for background.paper
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -27,7 +27,7 @@ function options(themeType: "light" | "dark"): ThemeOptions {
|
||||||
|
|
||||||
const signature = getSignatureColour();
|
const signature = getSignatureColour();
|
||||||
const accent = getSignatureAccentColour();
|
const accent = getSignatureAccentColour();
|
||||||
const bg = generateBackgroundShades(Colours.grey[800], themeType)
|
const bg = generateBackgroundShades(themeType)
|
||||||
return {
|
return {
|
||||||
palette: {
|
palette: {
|
||||||
primary: Colours[getPrimaryColour() as keyof typeof Colours],
|
primary: Colours[getPrimaryColour() as keyof typeof Colours],
|
||||||
|
|
@ -197,9 +197,29 @@ function options(themeType: "light" | "dark"): ThemeOptions {
|
||||||
color: accent, // Customize ripple color here
|
color: accent, // Customize ripple color here
|
||||||
// color: "white"
|
// color: "white"
|
||||||
},
|
},
|
||||||
|
'&:hover': {
|
||||||
|
color: themeType === "light" ? signature : "white", // Customize ripple color here
|
||||||
|
// color: "white"
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
MuiCssBaseline: {
|
||||||
|
styleOverrides: {
|
||||||
|
body: {
|
||||||
|
backgroundColor: bg, // Set your desired background color
|
||||||
|
// color: '#333', // Optionally, you can also set the default text color
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
MuiSvgIcon: {
|
||||||
|
styleOverrides: {
|
||||||
|
root: {
|
||||||
|
// Set the default icon color for light mode
|
||||||
|
// color: "black", // Dark color for icons in light mode
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
} as ThemeOptions;
|
} as ThemeOptions;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue